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.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityHow 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.
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;