By default this has been removed from WooCommerce 2.6 to avoid obvious situations such as “Free Shipping: (Free)”, but in some cases it’s required display some message and this is possible with the following code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Display (Free) when shipping method does not charge any cost. | |
* | |
* @param String $label Shipping method label. | |
* @param WC_Shipping_Rate $method Shipping method data. | |
* @return string | |
*/ | |
function my_wc_custom_free_shipping_label( $label, $method ) { | |
// Only apply when is free and not using the free shipping method. | |
if ( '0.00' === $method->cost && 'free_shipping' !== $method->method_id ) { | |
$label = sprintf( __( '%s: (Free)', 'text-domain' ), $label ); | |
} | |
return $label; | |
} | |
add_filter( 'woocommerce_cart_shipping_method_full_label', 'my_wc_custom_free_shipping_label', 10, 2 ); |
Note that the code above don’t include any message for the “Free Shipping” method.