0

how to off free shipping for specific states.

Example:

I have free shipping for all items over item total $100.

I do not want to have free shipping for USA state of Hawaii, Alaska.

Please advice.

Thank you,

1 Answer 1

0

On select of state create a function in js onclick=myfunction()

in that function get your current shipping information from quote and apply

if(shipping_state == 'Hawaii')
//refresh whole shipping details
                                var processors = [];
                                rateRegistry.set(quote.shippingAddress().getCacheKey(), null);
                                processors.default =  defaultProcessor;
                                processors['customer-address'] = customerAddressProcessor;
                                var type = quote.shippingAddress().getType();
                                if (processors[type]) {
                                    processors[type].getRates(quote.shippingAddress());
                                } else {
                                    processors.default.getRates(quote.shippingAddress());
                                }
}

in this if hide that shipping method and refresh the whole shipping details hope you get my point upvote if helps

2
  • can you please help me with file paths where should be executing code – Commented Sep 27, 2020 at 10:58
  • just on click of shipping method call a JS function from either same PHTML file or from custom JS file
    – Asad Ullah
    Commented Oct 2, 2020 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.