How to Control Who Can Duplicate WooCommerce Products
One PublishPress user came to us with an interesting question. They wanted to give their WooCommerce a specific set of permissions: edit and duplicate only their own WooCommerce products.
This seems like it should be a straightforward task, but it turned out to be more complicated than we expected. This post will explain how we solved the problem using the PublishPress Capabilities plugin.
If you install PublishPress Capabilities, you can follow along with this guide. Go to “Capabilities” to see the options.
The obvious choice is to remove the “edit others” permission for WooCommerce products. You can see how this is done in the screenshot below.
If I uncheck the “edit others” box, this will successfully prevent the user from editing other users' posts. However, it also prevents them from duplicating a product they have created themselves. Look at the screenshot below and you'll see where a “Duplicate” link should normally be available.
So what's the solution? PublishPress Capabilities enables you to use a new permission called duplicate_products.
- Go to “Capabilities”.
- Use the “Select Role to View / Edit” box in the top-right corner.
- Load the role whose permissions you want to edit.
- Now look for the “Add Capability” box in the right sidebar.
- Enter “duplicate_products”.
- Click the”Add to role” button.
- Go to the center of the screen.
- Check the “duplicate products” box.
- Click the blue “Save Changes” button.
Now your user will be able to duplicate their own products, using the “Duplicate” link you see below:
So, let's summarize what we've learned … “duplicate_products” is not a permission that you will see after installing WooCommerce. However, this permission is available and does allow you to control who can duplicate WooCommerce products.