I need help, please.

  • I created a cms page with id=terms
  • I insert in the content of web page this code:

    {{block class="Magento\Framework\View\Element\Template" template="Magento_Theme::test/test.phtml"}}
  • I create the test.phtml file in folder:


  • Into test.phtml I insert the code:

    <?php echo "Hello World!"; ?>;

All it's alright. The output of www.dominio.com/terms is "hello world".

Now I would like changing the php code for display the Terms and Conditions configured in STORE, SETTINGS.

Can you help me, please?


  • Where is this store settings ?
    – PЯINCƎ
    Commented Aug 7, 2018 at 20:41

1 Answer 1


If I understood correctly you want to get in your phtml the content of your termes & conditions set in Stores > under Settings > Terms and Conditions.

So 1st solution and the best is to add some function in your block module then you get that function in your phtml to avoid using directly the objectManager in a phtml, 2nd solution you can do it direclty in phtml without a block but it is not recommended.

1st solution:


namespace {Vendor}\{Module}\Block;
class agreements extends \Magento\Framework\View\Element\Template
    protected $_agreements;

    public function __construct(
        \Magento\Framework\View\Element\Template\Context $context,
        \Magento\CheckoutAgreements\Model\Agreement $agreements
        $this->_agreements = $agreements;

    public function getAgreements($agreementId)
        $agree =  $this->_agreements->load($agreementId);
        return $agree->getContent();

in test.phtml you add this :

<?php echo $this->getAgreements(1); ?> //1 is the termes & conditions ID

2nd solution


<?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance();?>
<?php $agreements = $objectManager->create('Magento\CheckoutAgreements\Model\Agreement')->load(1);?> //here 1 is the ID of your termes & conditions.
<?php echo $agreements->getContent();?>
  • hi @Prince, can you please explain in detail? can we show terms and condtions from cms block in checkout? Commented Dec 11, 2018 at 8:04
  • @PЯINCƎ how to get Terms and Conditions id dynamically? Commented Jan 28, 2022 at 6:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.