Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change WC shipping title when cost is $0
<?php // only copy this line if needed
/**
* Changes the shipping label if the cost is $0
*
* @param string $label the shipping method label
* @param obj $method \WC_Shipping_Rate
* @return string - new shipping method label
*/
function sww_wc_free_shipping_label( $label, $method ) {
if ( 0 == $method->cost ) {
$label = 'Free shipping!';
}
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'sww_wc_free_shipping_label', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment