1

I'm trying to add a new CMS block into the sidebar and remove all other blocks there, using only the Layout Update XML section in a CMS Page via the admin panel, how could I do it?

Magento 2 - Layout Update XML

1 Answer 1

1

You don't need to use the initial tags (e.g. page and body), you might be able to remove the Compare products and Wishlist from the sidebar and add your custom CMS Block via this snippet below:

<referenceContainer name="content">
             <block class="Magento\Cms\Block\Block" name="contact_information" before="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">contact_information</argument>
                </arguments>
            </block>
</referenceContainer>

 <move element="contact_information" destination="sidebar.additional" before="-" />

<referenceContainer name="sidebar.additional">
        <referenceBlock name="catalog.compare.sidebar" remove="true"/>
        <referenceBlock name="wishlist_sidebar" remove="true"/>
</referenceContainer>

Your Answer

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

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