By default the plugin WooCommerce Order/Customer CSV Export is available to use for anyone who can manage the shop. This means that all the administrators and shop managers will be able to use it.
But you might need to change this. For example, you might need to exclude the shop managers, and only allow administrators to do this.
Is it possible? Obviously yes!
Open the file functions.php located in wp-content/themes/your-theme-name/ and add this code at the end of the file:
It seems to be complex, but it’s not.
It works also when you don’t have the plugin active, so don’t worry to add/remove it when you update stuffs.
The first part of the code removes the menu WooCommerce > CSV Export for who does not have the capability
manage_options. This capability is only available for administrators and super administrators (available in multisites).
The second part removes all the buttons in WooCommerce > Orders, from the actions on the most right of the orders list, to the buttons inside the order edit page and the bulk edit dropdown.
You can tweak this code, to extend the availability of the plugin to more roles, instead of restrict it like i did in this tutorial.
Leave a Reply