I want to calculate Shipping Rates on button click instead of postal code change.
1 Answer
If you are checking this file :
vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-service.js
There is the code :
quote.shippingAddress.subscribe(function () {
var type = quote.shippingAddress().getType();
if (processors[type]) {
processors[type].getRates(quote.shippingAddress());
} else {
processors.default.getRates(quote.shippingAddress());
}
});
Which getting the shipping rates. So you need to do the custom code on your button click, so it will call one function of js and from that js function you can call this code.