1

I want to call "estimate-shipping-methods" api on street field input change as it is called when the input of postcode, country field.

1 Answer 1

1

Add a mixin for shipping rates validation rules:

app/code/Vendor/Module/view/frontend/requirejs-config.js

var config = { config: { mixins: { 'Magento_Checkout/js/model/shipping-rates-validation-rules': { 'Vendor_Module/js/checkout/model/shipping-rates-validation-rules-mixin': true } } } }; 

app/code/Vendor/Module/view/frontend/web/js/checkout/model/shipping-rates-validation-rules-mixin.js

In mixin we will wrap the original rules and add the street:

define([ 'jquery', 'mage/utils/wrapper' ],function ($, Wrapper) { "use strict"; return function (origRules) { origRules.getObservableFields = Wrapper.wrap( origRules.getObservableFields, function (originalAction) { var fields = originalAction(); fields.push('street'); return fields; } ); return origRules; }; }); 

This will add the street rule to each available shipping method on the frontend.

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.