Created
January 23, 2024 17:53
-
-
Save stevejburge/dcef793341d129c10ce28e736d85536c to your computer and use it in GitHub Desktop.
WooCommerce Hide Refund Button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('admin_head', 'hide_wc_refund_button'); | |
function hide_wc_refund_button() { | |
global $post; | |
if (!current_user_can('administrator') && !current_user_can('editor')) { | |
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(); | |
if (jQuery('#original_post_status').val()=='wc-refunded') { | |
jQuery('#s2id_order_status').html('Refunded'); | |
} else { | |
jQuery('#order_status option[value=wc-refunded]').remove(); | |
} | |
}); | |
</script> | |
<?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment