WooCommerce Users Can Edit Products Only in Some Categories
A PublishPress customer had this WooCommerce question for us:
I want to create a “Product category manager” for my website. This person will only be able to control the products in one category called “Fashion”. Is this possible with your plugins?
Yes, you can do this with the PublishPress Permissions plugin.
Text and screenshot guide
In this guide, we will create a “Product Category Manager” user role.
- Install PublishPress Permissions and also the PublishPress Capabilities plugin.
- Go to “Capabilities” in your WordPress admin menu.
- Make sure that “Subscriber” is selected in “Select Role to View / Edit”. We're going to copy the Subscriber role because it has very limited permissions.
- Enter “Product Category Manager” into the “Copy Subscriber Role” box.
- Click “Copy”.
We're now going to add a new permission to give Product Category ManagerW access to the WordPress admin area. Click here for more info on admin area access with WooCommerce.
- Find the “Add Capability” box.
- Enter “view_admin_dashboard”.
- Click “Add to role”.
- Select the “view admin dashboard” box.
- Click “Save Changes”.
Now it's time to create the user
- Go to “Users” in your WordPress admin menu.
- Create a user in the “Product Category Manager” role.
- Go to “Products” then “Categories” in your WordPress admin menu.
- Click “Edit” for the category you want to restrict.
- Scroll down to the box “Permissions: Read Products in this Category”.
- Set “Product Category Manager” to “Enabled” for both options.
- Repeat this for the box “Permissions: Edit Products in this Category”.
Now you can test your user accounts. This is easier to do with the User Switching plugin installed.
This image below shows what the user will see. They will only be able to see the “Products” link in WooCommerce and products in their restricted category.