I'm attempting to use the 'woocommerce_order_shipping_to_display' filter to show 'Free' in the WooCommerce email table when no shipping charges will be incurred. In the image, I'm trying to get the 'Free' and 'Flat Rate' values to just show as free. My PHP is only moderate, but I can't get my code quite there. Does anyone see what I could be missing?
/* return custom text on email when shipping is free */
function filter_email_shipping_text( $shipping ) {
if ( $this->order_shipping != 0) ) {
$shipping = __( 'Free!', 'woocommerce' );
return $shipping;
} else {
return $shipping;
}
}
add_filter( 'woocommerce_order_shipping_to_display', 'filter_email_shipping_text', 1 );
if ( $this->order_shiping != 0 ) {