Last active
October 16, 2020 02:14
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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