![](https://gabfire.com/wp-content/uploads/2021/01/AdobeStock_337949563-1024x384.jpeg?6bfec1&6bfec1)
Let’s assume that you’d like to hide the WooCommerce menu for a certain user role, shop manager to be exact, and looking for a way to do it.
Using the capability together with the remove_menu() function, we can disable WooCommerce menu for any user roles. The function below is going to hide WooCommerce menu items for everyone except for admin.
add_action( 'admin_menu', 'remove_woocommerce_menu' ); function remove_woocommerce_menu(){ if ( !current_user_can('manage_options') ) { remove_menu_page( 'woocommerce' ); // Menu slug for WooCommerce } }