Skip to content

Instantly share code, notes, and snippets.

@kloon
Created October 9, 2017 12:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kloon/3703ffc703651feefe717bb438d4ad3d to your computer and use it in GitHub Desktop.
Save kloon/3703ffc703651feefe717bb438d4ad3d to your computer and use it in GitHub Desktop.
WooCommerce hide refund reason from customer
<?php
/**
* Replace refund reason with generic Refund text.
*
* @param $total_rows
* @param $order
* @param $tax_display
* @return array
*/
function remove_public_facing_refund_reason( $total_rows, $order, $tax_display ) {
foreach ( $total_rows as $id => $row ) {
if ( false !== stripos( $id, 'refund_' ) ) {
$total_rows[ $id ]['label'] = __( 'Refund' );
}
}
return $total_rows;
}
add_filter( 'woocommerce_get_order_item_totals', 'remove_public_facing_refund_reason', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment