/** * Update wooCommerce shop manager roles by wp-experts.in * @wooCommerce * @hooks remove_cap() to remove the existing user capability */ function we_update_shopmanager_role_caps() { // Gets the simple_role role object. $shop_manager = get_role( 'shop_manager' ); $caps = array( 'edit_others_products', 'read_private_pages' , 'read_private_posts' , 'edit_posts' , 'edit_published_posts' , 'edit_published_pages' , 'edit_private_pages' , 'edit_private_posts' , 'edit_others_posts' , 'edit_others_pages' , 'publish_posts' , 'delete_posts' , 'delete_private_pages' , 'delete_private_posts' , 'delete_published_pages' , 'delete_published_posts' , 'delete_others_posts' , 'delete_others_pages' , 'manage_categories' , 'manage_links' , 'moderate_comments' , 'upload_files' , 'export' , 'import' , 'list_users' , 'edit_theme_options'); foreach ( $caps as $cap ) { $shop_manager->remove_cap( $cap ); } } // Update shop manager user capabilities, priority must be after the initial role definition. add_action( 'init', 'we_update_shopmanager_role_caps', 11 );
How to allow shop manager to edit only WooCommerce settings
If you want to allow your Shop Managers only to access of woocommerce related settings like manage orders, manage payment, manage products..etc then you will need to restrict the existing shop manager user capability. You can change the woocommerce shop manager user capability using the woocommerce hooks function, there is no need to use any extra plugin for that. You will require to add given code into your theme function.php file.