selectBillingAddress$(): Observable<Address | null>¶
The selectBillingAddress$
method allows to get a current billing address in a basket.
Returned value¶
A returned value has a type of Observable<Address | null>
where Address represents an address object.
Example¶
In this example we make a basketAddressesApi
call to get a current billing address in the basket.
useStorefront(async ({ eventBus, getApi }) => {
eventBus.on('basket.initialized', async () => {
const basketAddressesApi = await getApi('basketAddressesApi');
const billingAddress$ = basketAddressesApi.selectBillingAddress$();
billingAddress$.subscribe((currentBillingAddress) => {
// do something with the address
});
});
});
Basket Address API methods reference¶
- getShippingAddress
- selectShippingAddress$
- setShippingAddress
- getBillingAddress
- setBillingAddress
- isBillingAddressEqualShippingAddress
- selectIsBillingAddressEqualShippingAddress$
- isDifferentShippingAddressRequired
- selectIsDifferentShippingAddressRequired$
- setBillingAddressAsShippingAddress
- getSectionValidation
- selectSectionValidation$