I need some help in WooCommerce Shipping method. How can I show the value of shipping class on the cart page. Let me explain little bit my problem.
I added a flat ra
You can add a filter, checking if the cost of your shipping method is zero (WooCommerce currently is doing nothing else in their function than printing the "flat rate" label, if the cost isn't above zero) and changing your label to whatever you'd like:
add_filter( 'woocommerce_cart_shipping_method_full_label', 'add_free_shipping_label', 10, 2 );
function add_free_shipping_label( $label, $method ) {
if ( $method->cost == 0 ) {
$label = 'Free shipping'; //not quite elegant hard coded string
}
return $label;
}
Based on https://stackoverflow.com/a/23581656/8264519 and works like a charm.
Thank you @DhirenPatel for your question. The following additional code works for the thank you page and email:
add_filter( 'woocommerce_order_shipping_to_display', 'add_free_shipping_label_email', 10, 2 );
function add_free_shipping_label_email( $label, $method ) {
if ( $method->cost == 0 ) {
$label = 'Free shipping'; //not quite elegant hard coded string
}
return $label;
}