Create Users Who Only Access WooCommerce Analytics Coupons Menu
One PublishPress user asked how can they create a custom user role that can only access 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 to 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:
- Login to 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 login to that user, your screen will look like the image below.
- In the image above you can see the “Sales reports” menu and we should hide it.
- We can hide it using “Admin Features” option.
- Insert this ID “#toplevel_page_wc-reports”, as in the image below.
- That should complete the process. When you try to login as a user in the Coupon Manager role, you will see something like this screenshot below.