Block refunds in WooCommerce

What to do if you need that some role be able to create/edit Orders in WooCommerce but not be able to issue refunds? It will be good just revoke from a role the user capabilities which allows to work with refunds, but WooCommerce registerd a ‘refund’ custom post type with a ‘shop_order’ capability type. This means that refunds are protected by the same list of user capabilities as the orders: edit_shop_orders, publish_shop_orders, etc.
So we can not change a user role to achieve our purpose.

We can make this by hiding ‘Refund’ link at the order editor page using JavaScript code:

Setup it as a Must Use plugin or add to a functions.php file of your active theme.

Code is built on the base of these forum topics: 1st, 2nd.

Share