Created
April 23, 2019 14:03
-
-
Save PGeorgiev/c1598784b885be69898b2778aafab901 to your computer and use it in GitHub Desktop.
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 serdika_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', 'serdika_free_shipping_label', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment