WooCommerce hide zero value on zero cost shipping methods

In WooCommerce version 3.4, the dev team made a change to show the value of free shipping methods (other than actual Free Shipping). This means if you use Local Pickup or other methods of shipping that don’t have a preset or calculated cost, the shipping labels on both the cart and checkout to appear like this: Local Shipping: $0.00

This was an intentional change by WooCommerce. You can read the conversation and reasoning behind it here: https://github.com/woocommerce/woocommerce/pull/18624

A couple of our customers preferred the old way, where free shipping methods didn’t show a price:

If you too want to hide the zero value price on zero-cost shipping methods, use this filter in your functions.php file or custom functions plugin:

/*
 * Hide zero value on any zero cost shipping methods
 *
 */

add_filter( 'woocommerce_cart_shipping_method_full_label', function( $label, $method ) {

    if ( $method->cost <= 0 ) {

        $label = $method->get_label();
    }

    return $label;

}, 10, 2 );

11 comments

  • Eduardo

    Hi.
    My site is in spanish, and instead of “Local Pickup: $0.00”, I get “Local Pickup – Free shipping!” (all in Spanish)
    Is there a way of adapting the code as to remove the “Free shipping” part?
    Thanks.
    Regards.

    • Hi Eduardo,

      I’m not sure what’s causing this without seeing the site directly, but if you’ve followed the steps above, the “- Free shipping!” part might be included in the label of the Local Pickup method. Give that a check.

  • Hello,

    Is it possible to hide 0.00 then visitor use “Local pickup”, but show 0.00 after other payments methods?

    Thx!

    • I’ll take a closer look at this Steve and see what’s possible – then write up a new post. Can you clarify your comment about ‘other payment methods’? Do you mean other shipping methods?

  • Thank you, this saved me a lot of time!

  • Unfortunately this does not work for me. Is it outdated or theme depending? Or do I need to do anything else besides just copy/paste to child theme functions.php?

    Cheers!

    • Hi Lizzy. I just checked and it’s still working for us – with both WooCommerce and WordPress fully updated. So I’m assuming the code is still working.

      Are you testing this locally or in a live production environment. Is there any chance the site could be caching/displaying old files?

  • Is there any way if there are more shipping methods and someany of them has value 0,00 that you can hide the complet shipping method includes the radio button?

    Example:

    (Rb) shipping 1: 7,00$
    (Rb) shipping 2: 0.00$ (<— hide the complet shipping method)

  • That’s the only place I found this solution, huge thanks.

Leave your comment