One PublishPress user asked how to create a custom user role that only has access to the “Coupons” area in the WooCommerce Analytics area.
They did not want the user to have access to the WooCommerce report menu. This user was a marketing person and only needed to check on the success of their marketing campaigns that use coupons.
PublishPress Capabilities Pro is a plugin that gives you control over who can access which admin menu links. In this scenario, a little extra work is needed since the “Coupons” menu is connected to the WooCommerce “Reports” menu.
However, thanks to PublishPress Capabilities Pro, we were able to answer the customer's question. Here are the steps to do that:
- Log into your WordPress admin, then go to Capabilities > Role.
- Copy the “Subscriber” role and give it a name. In this case, I named it “Coupon Manager”.
- Navigate to the “WooCommerce” tab and check the box to disable WooCommerce admin restrictions.
- Go to “Capabilities”.
- Select the new role that we have created.
- Choose the “WooCommerce” tab.
- Find the “view woocommerce reports” capabilities and check this box.
- Click “Save Changes”.
- Go to “Admin Menus”.
- Disable all the menu links except “Analytics” and “Coupons”.
- Create a user in the “Coupon Manager” role.
- You can use the “User Testing” feature in PublishPress Capabilities to test this account.
- When you try to log into that user, your screen will look like the image below.
- In the image above you can see the “Sales reports” menu, but we need to hide it.
- We can hide it using the “Admin Features” option.
- Insert this ID “#toplevel_page_wc-reports”, as in the image below.
- That should complete the process. When you try to log in as a user in the Coupon Manager role, you will see something like this screenshot below.