There are mainly 2 filters to be used:
1) the filter woocommerce_order_shipping_to_display
located in get_shipping_to_display()
method, used by get_order_item_totals()
method to display the shipping in order total rows:
add_filter( 'woocommerce_order_shipping_to_display', 'customize_order_shipping_to_display', 10, 3 );
function customize_order_shipping_to_display( $shipping, $order, $tax_display ){
// Your code to filter displayed shipping
return $shipping;
}
2) Or filter woocommerce_get_order_item_totals
located in get_order_item_totals()
method that is used to display the order total rows:
add_filter( 'woocommerce_get_order_item_totals', 'customize_order_item_totals', 10, 3 );
function customize_order_item_totals( $total_rows, $order, $tax_display ){
// You can make changes below
$total_rows['shipping']['label'] = __( 'Shipping:', 'woocommerce' ); // The row shipping label
$total_rows['shipping']['value'] = $order->get_shipping_to_display( $tax_display ); // The row shipping value
return $total_rows;
}
Code goes in functions.php file of your active child theme (or active theme).