{"id":938,"date":"2020-04-12T09:33:52","date_gmt":"2020-04-12T09:33:52","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/04\/12\/remove-menu-from-header-in-magento-2\/"},"modified":"2025-05-22T13:35:04","modified_gmt":"2025-05-22T08:05:04","slug":"remove-menu-from-header-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/remove-menu-from-header-in-magento-2\/","title":{"rendered":"How To Remove Menu From Header In Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Ever tried to remove the main menu from the header in Magento 2? Maybe because you wanted a customized menu instead of the default one. Or you have a one-page website which doesn\u2019t require menu at all. Or the client\u2019s site did not require the menu altogether!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In such cases, you need to&nbsp;<em><strong>remove menu from header in Magento 2<\/strong><\/em>&nbsp;and here\u2019s the programmatic solution to do the same.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, you don\u2019t want to distract a user on the checkout page when he is about to make a conversion on your site with a menu that may prompt him to check or browse more.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">So, you can simply remove the main menu from the header and speed up the conversion process at the checkout.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Programmatic method to remove menu from header in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Add below code into XML file where you want to remove the navigation menu:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;referenceContainer name=\"header-wrapper\">\n            &lt;referenceBlock name=\"navigation.sections\" remove=\"true\" \/>\n        &lt;\/referenceContainer><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">To remove the main menu from all pages in Magento 2:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create&nbsp;<em><strong><em><strong>app\\code\\[Vendor]\\[Module]\\frontend\\layout\\default.xml<\/strong><\/em><\/strong><\/em><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;?xml version=\"1.0\"?>\n   &lt;page xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"urn:magento:framework:View\/Layout\/etc\/page_configuration.xsd\">\n     &lt;body>\n        &lt;referenceContainer name=\"header-wrapper\">\n            &lt;referenceBlock name=\"navigation.sections\" remove=\"true\" \/>\n        &lt;\/referenceContainer>\n    &lt;\/body>\n&lt;\/page><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to share the solution with Magento community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever tried to remove the main menu from the header in Magento 2? Maybe because you wanted a customized menu instead of the default one&#8230;.<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-938","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/938","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=938"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/938\/revisions"}],"predecessor-version":[{"id":14973,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/938\/revisions\/14973"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=938"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=938"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=938"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}