i am trying the following code :

<referenceContainer name="page.top"> <referenceBlock name="main_menu" remove="true" /> </referenceContainer>

in the DESIGN TAB > Layout Update XML in my page. but its not working.

my block's id is > 89 identifier is > main_menu and title is > Home 01- main menu. what else could i do to make this code work. basically, i want to remove this block from the homepage.


just hide it on home page.

check your body tag classes, there will be some unique class on home page body tag.

<body class="cms-home cms-index-index" >


by css you can hide it on only home page :)

  • can you tell me how and where to hide it? in which file? – Laiba Feb 23 '18 at 12:15
  • can you give some html snippet from that block, which you want to hide? – Ganesh Godshelwar Feb 23 '18 at 12:17
  • <div class="main-menu menu-style-2">{{widget type="CleverSoft\CleverMegaMenus\Block\Widget\Megamenu" menu="main_menu"}}</div> <div class="zoo-customer-service text-right hidden-xs hidden-sm"> <p>Customer Service: <span style="font-weight: 600;"> (+xx) xxx- 7200-151</span></p> </div> thats the html used in this block – Laiba Feb 23 '18 at 12:19
  • add in custom.css , body.cms-home div.main-menu.menu-style-2{display:none} – Ganesh Godshelwar Feb 23 '18 at 12:24
  • i am anxiously waiting for your humble suggestion and solutions – Laiba Feb 23 '18 at 12:25

Have you try not to reference the Container?

As I see here, a friend has remove the wishlist sidebar only with Block's reference.

  • yes @christoforos i've tried it and doing this shows me the following error – Laiba Feb 23 '18 at 12:06
  • Please correct the XML data and try again. Element 'referenceBlock': This element is not expected. Expected is one of ( referenceContainer, container, update, move ). Line: 1 – Laiba Feb 23 '18 at 12:06
  • Have you enable path hints (Enabled Template Path Hints for Storefront) and block hints (Add Block Names to Hints) in the admin interface? You will find them here: Stores > Configuration > Advanced > Developer > Debug – Christoforos Kotsios Feb 23 '18 at 12:09
  • maybe not. can you guid me how can i enable that setting? – Laiba Feb 23 '18 at 12:09
  • I edit the comment. Check in the path I add. – Christoforos Kotsios Feb 23 '18 at 12:10

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.