cancel
Showing results for 
Search instead for 
Did you mean: 

Access customer address list on checkout

Access customer address list on checkout

Hello,

 

I'm trying to custom the checkout of Magento 2 by hiding specific customer addresses on checkout.

Everything is working fine except for the file "magento/web/vendor/magento/module-checkout/view/frontend/web/js/model/shipping-save-processor/default.js", I would like from this file to access the customer address list defined in shipping-address/list.js but I do not understand how can I do it ?

I tried the code below but I have the error :

Uncaught TypeError: billingAddress.getCacheKey is not a function
var customerData = window.customerData;
var shippingAddress = quote.shippingAddress();

customerData.addresses.forEach(function (address) {
   if(shippingAddress['customerId'] == address['customer_id'] && address['default_billing'] == true) {
       selectBillingAddressAction(address);
   }
});

Thanks for your help !