How to Update and Eliminate Menu in Magento 2

Today, we are going to discuss how to update or eliminate existing menu of another module without modifying the source code in Magento 2. The following steps:

Step 1: Create a menu.XML file in your module

Step 2: State the update / remove commands in the menu.xml file

In the previous post, I have explained you how to include menu in Magento 2: How to built Admin Menu in Magento 2.

  1. Create a menu.XML file in your module

/app/code/[NameSpace]/[ModuleName]/etc/adminhtml/menu.xml

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">

    <menu>

    </menu>

</config>
  1. State the update / remove commands in the menu.xml file

Update the existing menu:

In this example, I updated the module menu products / catalog Magento Catalog. The title was modified from Catalog to New Catalog, and moved from the catalog/ product to [your_custom_route] / product.

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">

    <menu>

        <update id="Magento_Catalog::catalog_products"

             title="New Catalog"

             action="[your_custom_route]/product"/>

    </menu>

</config>
  • Eliminate an existing menu

In the following example, I have eliminate menu Product/Categories of Magento_catalog module

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">

    <menu>

        <remove id="Magento_Catalog::catalog_categories"/>

    </menu>

</config>

The above mentioned steps are the simplest process for you to Update or Eliminate Menu in Magento 2 Backend. With this guide, you can manage the Menu in Magento 2 easily. Each store has a Menu in Magento 2 with various features.

Last Update: April 7, 2018  

March 9, 2018   208   Nandini R    Operations    
Total 0 Votes:
0

Tell us how can we improve this post?

+ = Verify Human or Spambot ?

Leave a Reply

Your email address will not be published. Required fields are marked *

Facebook
Twitter
INSTAGRAM
LinkedIn