Skip to content

Instantly share code, notes, and snippets.

@bporcelli
Last active October 16, 2020 02:14
Show Gist options
  • Select an option

  • Save bporcelli/d73fb01917a9e129df70e6ec751a7623 to your computer and use it in GitHub Desktop.

Select an option

Save bporcelli/d73fb01917a9e129df70e6ec751a7623 to your computer and use it in GitHub Desktop.
Change the label the Plugin Pros Table Rate Shipping plugin uses for free shipping.
<?php
/**
* Changes the label Table Rate Shipping uses for free shipping.
* Replace NEW_FREE_SHIPPING_LABEL with the label you want to use
* for free shipping.
*
* @param string $label Shipping method label.
* @param WC_Shipping_Rate $method Shipping method rate data.
*
* @return string
*/
function trs_change_free_shipping_label( $label, $method ) {
if ( 'wcv_table_rate_shipping' === $method->id && 0 === (int) $method->cost ) {
$label = 'NEW_FREE_SHIPPING_LABEL';
}
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'trs_change_free_shipping_label', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment