I want to create an empty container and get it rendered. Currently my empty container isn't showing up.

<container name="empty-container" htmlTag="div" htmlClass="my-class"/>

An empty container can be forced to render by including a text block.

<!-- Force container to render -->
<block class="Magento\Framework\View\Element\Text">
        <argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>

Thanks to https://gist.github.com/Quinten/47ed93666001938b988d

  • this solution doesn't work anymore. – ndlinh Nov 5 '20 at 11:51

Add this empty block to container.

<block class="Magento\Framework\View\Element\Text" name="empty-block">
    <action method="setText">
        <argument name="text" xsi:type="string"><![CDATA[&nbsp;]]></argument>

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.