Change WordPress user roles and capabilities › Forums › How to or FAQ › Restrict Role from Processing Refunds in WooCommerce › Reply To: Restrict Role from Processing Refunds in WooCommerce
13/09/2016 at 13:25
#2730
Vladimir
Keymaster
Try this updated version:
add_action('admin_head', 'hide_wc_refund_button');
function hide_wc_refund_button() {
global $post;
if (!current_user_can('sales')) {
return;
}
if (strpos($_SERVER['REQUEST_URI'], 'post.php?post=') === false) {
return;
}
if (empty($post) || $post->post_type != 'shop_order') {
return;
}
?>
<script>
jQuery(function () {
jQuery('.refund-items').hide();
jQuery('.order_actions option[value=send_email_customer_refunded_order]').remove();
});
</script>
<?php
}