1

How can I update shipping methods on checkout with changes in zipcode input?

My shipping methods are not updating with zipcode input change value. Only with page refresh.

  • Are your custom shipping or default Magento? – Khoa TruongDinh Mar 8 '18 at 5:54
  • Yes, I have installed bitbucket.org/igor_lm/igorludgero_correiosofflinem2/wiki/Home – Plim Mar 8 '18 at 12:02
  • The shipping rates only update when I leave zipcode input empty – Plim Mar 8 '18 at 12:06
  • I believe that is a cookie problem, when I clear postcode on cookie (mage-cache-storage) and refresh the page with ctrl+shift+r (google chrome to clear cache) the update shipping rates works – Plim Mar 8 '18 at 13:47
2

I fix that editing this function on shipping.js:

               checkoutProvider.on('shippingAddress', function (shippingAddressData) {
                    /* Custom code to update shipping rates init */
                    if(s_postcode == null){
                        s_postcode = shippingAddressData.postcode;
                    }else{
                        if(shippingAddressData.postcode != s_postcode && shippingAddressData.postcode.length == 9){

                     checkoutDataResolver.resolveEstimationAddress();
                        }else{
                            if(s_postcode != null){
                                shippingAddressData.postcode = s_postcode;
                            }
                        }
                    }
                    /* Custom code to update shipping rates init */
                    checkoutData.setShippingAddressFromData(shippingAddressData);
                });

and declarate var:

var s_postcode = null;

Your Answer

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

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