hide-zero-value-on-zero-cost-shipping-methods-woocommerce

Hide Zero Value On Zero Cost Shipping Methods WooCommerce

In WooCommerce 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 with $0.00 price, like this: Local pickup: $0.00

Shipping label with 0 prices

This was an intentional change by WooCommerce. You can read the conversation and reasoning behind it here: github or add_rate() main function.

A couple of our customers preferred the old way, where free shipping methods didn’t show a $0.00 price:
Shipping methods didn't show $0.00 price
For hiding 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 < 1 ) {
        $label = $method->get_label();
    }
    return $label;
}, 10, 2 );

Remove shipping 0 price

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *