1

I want to hide only the free shipping method on the checkout page if the postal code 2nd index is 0. I tried this but it's not removing from shipping methods.

require(['mage/url', 'jquery','domReady!' ,'jquery/ui'],function(url , $)  {


$("[name='postcode']").live('change',function(){
        postCode = $("[name='postcode']").val();
         // console.log(postCode);
             postCode = postCode.slice(1,2);
             console.log(postCode);

        if(postCode == 0){

            // $('.checkout-shipping-method').hide();
             jQuery("#label_method_freeshipping_freeshipping").closest('.row').hide();
           // console   .log('Hellow');     


        }
        else{
            // $('.checkout-shipping-method').show();
            $('#label_method_freeshipping_freeshipping').closest('.row').show();
            $("#message").hide();

        }
    });


    });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.