Refunds can be a sore subject but it is something that every store has to deal with, keeping track of refund reasons can be very beneficial to you so you can keep pushing your refund rate down further and further.

The problem is that you do not always want your customer to see the reason you enter for when doing a refund, which WooCommerce will display by default to each customer.

Good news is that you can easily replace the refund reason in your customer-facing emails and pages with static text like just “Refund”.

Add the following code to end of your theme’s functions.php file omitting the opening <?php tag


<?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 );

view raw

functions.php

hosted with ❤ by GitHub