setBillingAddressAsShippingAddress(): Promise<void>¶
The setBillingAddressAsShippingAddress
is an asynchronous method which allows to set a billing address to the same value as the shipping address.
Returned value¶
A returned value has a type of Promise<void>
as this method does not return anything.
Example¶
In this example we make a basketAddressesApi
call to set a billing address to the value of the shipping address in the basket.
useStorefront(async ({ eventBus, getApi }) => {
eventBus.on('basket.initialized', async () => {
const basketAddressesApi = await getApi('basketAddressesApi');
await basketAddressesApi.setBillingAddressAsShippingAddress();
});
});
Basket Address API methods reference¶
- getShippingAddress
- selectShippingAddress$
- setShippingAddress
- getBillingAddress
- selectBillingAddress$
- setBillingAddress
- isBillingAddressEqualShippingAddress
- selectIsBillingAddressEqualShippingAddress$
- isDifferentShippingAddressRequired
- selectIsDifferentShippingAddressRequired$
- getSectionValidation
- selectSectionValidation$