Update shipping legacy flat rate label text when shipping cost “0”


Update shipping legacy flat rate label text when shipping cost ( Zero )”0″

function wc_update_flat_rate_label( $rates, $package ) {
if($rates[‘legacy_flat_rate’]->cost == 0){
$rates[‘legacy_flat_rate’]->label = “Free shipping”;
}
return $rates;
}
add_filter( ‘woocommerce_package_rates’, ‘wc_update_flat_rate_label’, 10, 2 );

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s