I would like to force update of the billing address as user is typing his firstname and lastname in the checkout. For example when it changes or on keyup.
I'm using a custom checkout module that only triggers this update when the postcode is changed or the country is changed.
I was thinking of creating a mixin for set-shipping-information
and monitor the elements so I can trigger this action but I honestly can't find any guide on how to approach this.
I tried writing my mixin like this
define([
'jquery',
'mage/utils/wrapper',
'Magento_Checkout/js/model/quote',
'Magento_Checkout/js/action/select-billing-address',
], function ($, wrapper, quote, selectBillingAddress, ) {
'use strict';
return function (setShippingInformationAction) {
$(document).on('change',"[name='firstname']",function(){
console.log('firstname changed');
//code to update billing address
});
return wrapper.wrap(setShippingInformationAction, function (originalAction) {
return originalAction(); // it is returning the flow to original action
});
};
});