I have Magento 2.2.3 and activated terms and conditions. And I added

{{block class="Magento\\Cms\\Block\\Block" area='frontend' block_id="agb"}} {{block class="Magento\\Cms\\Block\\Block" block_id="agb"}}

but in popup no text is shown, only above code is shown. Anyone an idea what is wrong? I use same snippet in other shop and it is working

Thanks! Martin enter image description here

  • Have you added static block in phtml file or CMS page ? – Hitesh Koshti May 4 '18 at 9:04
  • yes - and it is active – matin May 4 '18 at 9:13

The agreements are rendered via knockout js, therefore you cannot add a cms block to their content, you could go and extend the agreements module to process the data before sending it to the frontend via knockout, but i would just turn things around.

Don't include a cms block inside the agreements, but include the agreements in your cms page as follows:

use the Layout/design update xml field for the cms page with something like the following:

<referenceContainer name="content">
    <block class="Magento\CheckoutAgreements\Block\Agreements" name="agb.agreement" template="Vendor_Module::html/agreements/agb.phtml" after="-" />

and the corresponding template to insert exactly the one agreement you want:

 * @var $block \Magento\CheckoutAgreements\Block\Agreements

 * Define agreement for display
 * Copy this template if you wish to insert an agreements static content somewhere
 * @var $display_agreement string - Agreement id or name
$display_agreement = 'AGB';

 * Process
$was_found = false;
foreach ($block->getAgreements() as $agreement) {

    // Found requested agreement
    if ($agreement->getId() == $display_agreement || $agreement->getName() == $display_agreement) {
        $was_found = true;
        print '<div class="agreement_content">';
        if ($agreement->getIsHtml()) {
            /* @escapeNotVerified */
            print $agreement->getContent();
        } else {
            print nl2br($block->escapeHtml($agreement->getContent()));
        print '</div>';

if (!$was_found) {
    throw new Exception('Agreement display failed, could not find: ' + $display_agreement);

You can find some more info on the agreements block here: Why does getAgreements() return nothing?


agreement content is load from class Magento\CheckoutAgreements\Model\AgreementsConfigProvider protected function getAgreementsConfig()

'content' => $agreement->getIsHtml()
                ? $agreement->getContent()
                : nl2br($this->escaper->escapeHtml($agreement->getContent()))

could override using preference

use below function to get cms block content

/** @var \Magento\Framework\View\LayoutInterface  */
protected $_layout;

public function __construct(\Magento\Framework\View\LayoutInterface $layout)
    $this->_layout = $layout;

public function getContent()
    $cmsBlockId = 1; // id of cms block to use

    return $this->_layout->createBlock('Magento\Cms\Block\Block')->setBlockId($cmsBlockId)->toHtml();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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