I'm making a custom shipping module. When a user selects the shipping method, I want it to populate the shipping address fields with some custom address data.
I have overridden the select shipping method handler like so:
var config = {
map: {
'*': {
'Magento_Checkout/js/action/select-shipping-method':
'Vendor_Module/js/action/select-shipping-method'
}
}
};
I want to programatically set the form field values on the checkout page. Something like:
define([
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/select-shipping-address'
], function (quote, shipping) {
'use strict';
return function (shippingMethod) {
shipping.street("99 Road Street");
shipping.city("New York");
};
});
Is there a way to do this without just dumping in the values using jquery?