How to Control Permissions for WooCommerce Refunds

WooCommerce has permissions for many different features. For example, in another post, we saw how to control who edits orders in WooCommerce.

However, not all WooCommerce features have permissions. One PublishPress user wanted to control who can process refunds. This is possible with a little custom code.


How to hide the Refund options in WooCommerce #

We will need to hide two features in WoCommerce.

First, we need to hide the “Refund” button. You can see the “Refund” button by going to WooCommerce > Orders and editing an existing order. You can see the button in the image below:

Second, we need to hide the “Refunded” option that is under the “Status” dropdown. You can see this in the image below:


How to block users from refunds #

So if you want to block some users from processing refunds, what do you do? The solution is to hide the “Refund” button for some users. Click here to see the code to do this.

You can add this code directly to the functions.php file in your theme. So if you're using the Twenty Nineteen theme, your code will go into /wp-content/themes/twentynineteen/functions.php.

You will need to replace the seventh line with user roles that you DO NOT want processing refunds. In this example, I've entered two roles: “administrator” and “editor”.

Once this code is in place, people in the user roles you entered will not see the “Refund” button. The “Refunded” option will also be hidden in the “Status” dropdown.