Today, we are going to discuss how to update or eliminate the 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
Have a good online marketplace idea? Get Your Free Consultation Get your free Multi-vendor marketplace platform demo:Click here Build your marketplace business at just $99 with a robust extension
In the previous post, I have explained to you how to include a menu in Magento 2: How to build Admin Menu in Magento 2.
How to Update and Eliminate Menu in Magento 2?
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>
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 eliminated the 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 the 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.
Leave a Reply