Thanks @anjali-patil for giving a huge hint, I'll try to post here what he meant in more detail.
In your your component js file there is most likely a define(['A', 'B', 'C'], (A, B, C) => ...)
call which is an AMD way to require files your script depends on. Here you can add a dependency to 'Magento_Checkout/js/model/quote'
(if not already). quote.js
file provides you the info about the current quote, including shipping address (via shippingAddress()
method).
Example:
define([
'some/module.js', 'some/otherModule.js', 'Magento_Checkout/js/model/quote'
], ( someModule , someOtherModule , quote) => {
console.log(quote.shippingAddress());
})
It will output something like this:
{
"customerAddressId": "1",
"countryId": "LV",
"regionId": "368",
"regionCode": "Aizputes novads",
"region": "Aizputes novads",
"customerId": "1",
"street": ["Maskavas 379, 33"],
"telephone": "456456",
"postcode": "LV-1063",
"city": "Riga",
"firstname": "Artur",
"lastname": "Klesun"
}
'Magento_Customer/js/model/customer',
and get customer current details. – Sarfaraz bheda Jul 11 '18 at 12:43Magento_Checkout/js/model/quote
magento.stackexchange.com/questions/148788/… – Sarfaraz bheda Jul 11 '18 at 12:47