Skip to content

Instantly share code, notes, and snippets.

@WPprodigy
Last active June 23, 2017 04:25
Show Gist options
  • Save WPprodigy/273f49b8084dd04af40dacd4394fca5a to your computer and use it in GitHub Desktop.
Save WPprodigy/273f49b8084dd04af40dacd4394fca5a to your computer and use it in GitHub Desktop.
Rename the flat rate shipping label when the cost is $0
// Rename the flat rate shipping label when the cost is $0
function wc_ninja_change_flat_rate_label( $label, $method ) {
if ( 'flat_rate' == $method->method_id && $method->cost <= 0 ) {
$label = "Free Shipping";
}
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'wc_ninja_change_flat_rate_label', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment