Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Last active July 9, 2020 19:04
Show Gist options
  • Save bolderelements/a50696d7ee7ecd9ce48ef5a3e06c98d8 to your computer and use it in GitHub Desktop.
Save bolderelements/a50696d7ee7ecd9ce48ef5a3e06c98d8 to your computer and use it in GitHub Desktop.
Show the Word "FREE" When Shipping is $0 from Third Party Plugin
/**
* 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