I am using a wordpress theme which supports woocommerce,
when adding a user with shop manager role i don’t want to show the woocommerce menu.
Just need the products menu only.
please help.
I am using a wordpress theme which supports woocommerce,
when adding a user with shop manager role i don’t want to show the woocommerce menu.
Just need the products menu only.
please help.
You must be logged in to post a comment.
You can use WordPress’s ‘remove_menus()‘ function to do this.
Store Managers have a capability: ‘manage_woocommerce’
You can see that they are allowed to see the WooCommerce admin menu here:
‘/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php’
Look for:
$main_page = add_menu_page( __( 'WooCommerce', 'woocommerce' ), __( 'WooCommerce', 'woocommerce' ), 'manage_woocommerce', 'woocommerce' , array( $this, 'settings_page' ), null, '55.5' );
So much for the theory. To stop this admin menu item from displaying for anyone but an Administrator, add this to your functions.php file or plugin:
Don’t have the rep points to add a comment, but needs to change the hooked action from:
to:
and then you can do something like:
if you are trying to remove core woocommerce submenu items.
(responding to Do Xuan Nguyen’s comment)