Created
January 15, 2016 00:16
-
-
Save kittenlane/b1913696453401aa5383 to your computer and use it in GitHub Desktop.
Remove shipping name from the label in Cart and Checkout pages https://support.woothemes.com/hc/en-us/community/posts/202866646-Remove-label-for-shipping-method-
This file contains 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
/** | |
* Remove shipping name from the label in Cart and Checkout pages | |
*/ | |
add_filter( 'woocommerce_cart_shipping_method_full_label', 'wc_custom_shipping_labels', 10, 2 ); | |
function wc_custom_shipping_labels( $label, $method ) { | |
if ( $method->cost > 0 ) { | |
if ( WC()->cart->tax_display_cart == 'excl' ) { | |
$label = wc_price( $method->cost ); | |
if ( $method->get_shipping_tax() > 0 && WC()->cart->prices_include_tax ) { | |
$label .= ' <small>' . WC()->countries->ex_tax_or_vat() . '</small>'; | |
} | |
} else { | |
$label = wc_price( $method->cost + $method->get_shipping_tax() ); | |
if ( $method->get_shipping_tax() > 0 && ! WC()->cart->prices_include_tax ) { | |
$label = ' <small>' . WC()->countries->inc_tax_or_vat() . '</small>'; | |
} | |
} | |
} | |
return $label; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment