Allow Users to View And Not Edit WooCommerce Orders

We had an interesting request from a PublishPress user this week. They wanted to allow a WordPress user to view WooCommerce orders but not be able to edit the orders.

Normally there are two roles in WooCommerce called “Shop Manager” and “Customer“. We'll be expanding that list in this guide.

This is possible with the PublishPress plugins, and in this guide we'll explain how it's done.

  • Install the PublishPress Capabilities Pro plugin.
  • Install the PublishPress Permissions plugin.
  • Go to “Capabilities” then “Roles” in your WordPress admin area.
  • Click “Copy” under the “Contributor”. We're choosing this because it's a basic role with very limited permissions and is very similar to the new role we want to create.
Contrib Copy
Contrib Copy
  • Give a name to the new role. In this example, the name is “Order Viewer”.
  • Click “Create Role”.
Order Viewer
Order Viewer

Now you can set the capabilities for this new role.

  • Go to “Capabilities” in your WordPress admin menu.
  • Choose the new user role in the top-left corner.
  • Set up their capabilities, as in the screenshot below. The key boxes to check are “Edit” for Posts and “Edit” for Orders.
Edit Posts Order
Edit Posts Order

In the previous step we gave users in the role the ability to use “Edit” for Posts. If you don't want users to edit posts, here is what to do next:

  • Go to “Capabilities” then “Admin Menus” in your WordPress admin menu.
  • Choose the new user role in the top-left corner.
  • Check the box for “Posts”.
Block Posts Menu
Block Posts Menu

Now you can add a user to your new role and test what they can see. If you log in to your WordPress site as an “Order Viewer”, this screenshot below shows what the user will see. They will be able to view the order but they will not be able to edit it. If the user tries to edit the order, they will see the message, “Sorry, you are not allowed to edit this item.”

View Order Only
View Order Only

Users will be able to click on the eye icon in the center of the screenshot above. This will give them a modal window with all the details of the order.

Congratulations: you have successfully created a user role that can view but not edit orders.

Preview Order Modal
Preview Order Modal

Author

  • Steve Burge

    Steve is the founder of PublishPress. He's been working with open source software for over 20 years. Originally from the UK, he now lives in Sarasota in the USA. This profile is generated by the PublishPress Authors plugin.

2 Comments

  1. Guys, this doesn’t work anymore because the popup that is triggered by Preview eye icon now has Edit order options, which means the user can edit the order when we just wanted them to be able to view it.

  2. Thanks for letting us know, Percy. This is requires a Capabilities Pro feature. Could you open a support ticket and share what you’re seeing? We’ll update this guide with another fix.

Leave a Reply

Your email address will not be published. Required fields are marked *