Magento 2.2 – Remove Main Menu from Homepage

magento2.2menuxml

I'm trying to remove the main menu from the homepage, for this I used the following code in my custom template:

<referenceBlock name="store.menu" remove="true" />

But the menu is still there while other settings in the template work fine.

What else should I do to remove this main menu ?

Best Answer

To remove the main menu from your home page do the following thing

Create your own theme at this location

magento_root\app\design\frontend\Themes_package\theme\

Create a theme folder there at below location

magento_root\app\design\frontend\Themes_package\theme\Magento_Theme

Create a default.xml file there at below location

magento_root\app\design\frontend\Themes_package\theme\Magento_Theme\layout\default.xml

Put this code there

<?xml version="1.0"?>
   <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
     <body>
        <referenceBlock name="navigation.sections" remove="true"/>
    </body>
</page>

This will remove your navigation section

Thank You!

Related Topic