Last active
July 9, 2020 19:04
-
-
Save bolderelements/a50696d7ee7ecd9ce48ef5a3e06c98d8 to your computer and use it in GitHub Desktop.
Show the Word "FREE" When Shipping is $0 from Third Party Plugin
This file contains hidden or 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
/** | |
* Show the word "FREE" when shipping is free from third party shipping plugins | |
* Code snippets should be added to the functions.php file of your child theme | |
* (Updated for WooCommerce 3.5) | |
* | |
* @return string | |
*/ | |
add_filter( 'woocommerce_cart_shipping_method_full_label', function( $label, $method ) { | |
// only update for Free shipping methods | |
$has_cost = 0 < $method->cost; | |
if ( ! $has_cost ) { | |
$label = $method->get_label() . ': FREE'; | |
} | |
return $label; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment