45
In the past, WooCommerce Cart and Checkout pages used to show “$0.00” beside each free shipping rate. Now, this is gone and WooCommerce only shows the shipping rate name, without the 0 amount.
But given that many freelance clients requested this customization, today we’re bringing this back to life with just a few lines of PHP. Enjoy!
PHP Snippet: Display $0.00 Amount For Free Shipping Rates @ WooCommerce Cart, Checkout, Thank You Page, Emails, etc.
/**
* @snippet Show $0.00 Price Beside Free Shipping Rates
* @how-to Get tutoraspire.com FREE
* @author Tutor Aspire
* @compatible WooCommerce 6
* @donate $9 https://tutoraspire.com
*/
add_filter( 'woocommerce_cart_shipping_method_full_label', 'tutoraspire_add_0_to_shipping_label', 9999, 2 );
function tutoraspire_add_0_to_shipping_label( $label, $method ) {
if ( ! ( $method->cost > 0 ) ) {
$label .= ': ' . wc_price( 0 );
}
return $label;
}
add_filter( 'woocommerce_order_shipping_to_display', 'tutoraspire_add_0_to_shipping_label_ordered', 9999, 3 );
function tutoraspire_add_0_to_shipping_label_ordered( $shipping, $order, $tax_display ) {
if ( ! ( 0 get_shipping_total() ) ) && $order->get_shipping_method() ) {
$shipping .= ': ' . wc_price( 0 );
}
return $shipping;
}