2

I want to remove the shipping row in check out page whenever the shipping total price is 0. Check this

For now this is the code I got. This code allows to hide the shipping row, Using the shipping fee I can create condition to hide it on check out page. Thank you

function disable_shipping_calc_on_cart($show_shipping) {
if(is_checkout()){
return false;
}
return $show_shipping;
}
add_filter( 'woocommerce_cart_ready_to_calc_shipping', 'disable_shipping_calc_on_cart', 99 );
kirito127
  • 61
  • 2
  • 10

1 Answers1

0

please add this filter woocommerce_cart_shipping_method_full_label in functions.php

add_filter( 'woocommerce_cart_shipping_method_full_label', 'add_free_shipping_label', 10, 2 );
    function add_free_shipping_label( $label, $method ) {
        if ( is_checkout() && $method->cost == 0 ) {
            echo '<style>tr.shipping{display:none;}</style>';
        }
        return $label;
    }

Reference

Gufran Hasan
  • 8,910
  • 7
  • 38
  • 51