{"id":524,"date":"2019-07-25T23:31:58","date_gmt":"2019-07-25T23:31:58","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2019\/07\/25\/disable-admin-menu-items-by-configuration-value-in-magento-2\/"},"modified":"2025-05-22T16:14:06","modified_gmt":"2025-05-22T10:44:06","slug":"disable-admin-menu-items-by-configuration-value-in-magento-2","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/disable-admin-menu-items-by-configuration-value-in-magento-2\/","title":{"rendered":"How To Disable Admin Menu Items By Configuration Value in Magento 2"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The Magento 2 admin interface must be kept simple. Any unnecessary menu should be removed in order to keep the admin panel as clean as possible. Also, if you manage multiple admin users, you may want to hide some menu items from some of the users.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In case of the Magento 2 extensions, if it\u2019s disabled from the configuration section, it\u2019s useless to show menu items in the admin panel which occupies the space and make the menu lengthy. It\u2019s where you need to<strong><em>&nbsp;disable admin menu items by configuration value in Magento 2<\/em><\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, it may not be feasible all the time to entirely remove a menu or tab altogether. You may need it when the requirements differ.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The below screenshots show how the admin menu tab is enabled and then disabled based on the configuration value:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Configuration Enabled:&nbsp;<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/07\/Configuration-Enabled.png\" alt=\"Configuration Enabled\" class=\"wp-image-6093\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>The solution will fetch the configuration value, if it&#8217;s disabled, it will hide the menu items:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2019\/07\/Configuration-Disabled.png\" alt=\"Configuration Disabled\" class=\"wp-image-6094\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Method To Disable Admin Menu Items By Configuration Value in Magento 2:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Add the below code snippet in&nbsp;<strong>menu.xml<\/strong> &nbsp;file:<\/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;add id=\"Vendor_Extension::Extension\" resource=\"Vendor_Extension::extension\"     module=\"Vendor_Extension\" title=\"Extension\" sortOrder=\"20\"  dependsOnConfig=\"section_id\/group_id\/field_id\" \/><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Here, the value of &#8220;<strong>section_id\/groupe_id\/field_id<\/strong>&#8221; is based on the system configuration value.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That&#8217;s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">An easy way to keep the backend admin panel sorted!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">I\u2019d be very grateful if you helped share this helpful post on social media to fellow developers!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thanks!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Magento 2 admin interface must be kept simple. Any unnecessary menu should be removed in order to keep the admin panel as clean as&#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-524","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/524","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=524"}],"version-history":[{"count":3,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/524\/revisions"}],"predecessor-version":[{"id":15327,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/524\/revisions\/15327"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}