I want to remove the block from referenceContainer. I have gone through the below link:

Remove block from layout in Magento 2

And tried to remove as per the above answer:

<referenceBlock name="footer-container" remove="true"/>

But it's removing whole container. I want to remove the particular block.

Below is my layout.xml code:

<referenceContainer name="footer-container">
            <block class="Vendor\Module_Name\Block\Template" name="footer_block" template="html/footer.phtml">
                <block class="Magento\Store\Block\Switcher" name="footer.store_switcher" template="switch/stores.phtml"/>
                <block class="Magento\Newsletter\Block\Subscribe" name="footer.newsletter" template="subscribe_footer.phtml"/>

I want to remove only footer.store_switcher and footer.newsletter. I am using the below code to remove both blocks.

<referenceBlock name="footer.store_switcher" remove="true"/>
<referenceBlock name="footer.newsletter" remove="true"/>

default.xml file path:


Please help me.

  • you have did right for remove block, after doing last, <referenceBlock name="footer.store_switcher" remove="true"/> <referenceBlock name="footer.newsletter" remove="true"/>not working for you? – Rakesh Jesadiya Mar 14 '17 at 10:18
  • @RakeshJesadiya could you please elaborate more? I can't understand what you are saying. No both are not working for me. – mageDev0688 Mar 14 '17 at 10:22
  • I think you have did right xml code for remove footer.store_switcher and newsletter. May be check after clear cache – Rakesh Jesadiya Mar 14 '17 at 10:23
  • I have cleared the cache lots of time after write code in xml. – mageDev0688 Mar 14 '17 at 10:25
  • you have to do it inside default.xml file not inside layout.xml file – Rakesh Jesadiya Mar 14 '17 at 10:26

You can remove using that code:

<referenceContainer name="footer-container" remove="true"/>
<referenceBlock name="form.subscribe" remove="true"/>
|improve this answer|||||
  • 1
    Lot of help me for today +V – Amit Bera Jan 24 '18 at 8:03
  • 1
    Also Use : <referenceBlock name="form.subscribe" remove="true"/> – Pradeep Thakur Feb 21 '19 at 9:43

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.