Skip to content

Instantly share code, notes, and snippets.

@kittenlane
Created January 15, 2016 00:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kittenlane/b1913696453401aa5383 to your computer and use it in GitHub Desktop.
Save kittenlane/b1913696453401aa5383 to your computer and use it in GitHub Desktop.
/**
* 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