selectIsBillingAddressEqualShippingAddress$(): Observable<boolean>¶
The selectIsBillingAddressEqualShippingAddress$
method allows to check if the billing address is currently equal to the shipping address.
Returned value¶
A returned value has a type of Observable<boolean>
indicating whether the addresses are currently equal or not.
Example¶
In this example we make a basketAddressesApi
call to check if the billing address is equal to the shipping address.
useStorefront(async (storefront) => {
let basketAddressesApi = storefront.getApiSync('basketAddressesApi');
if (!basketAddressesApi) {
const featureSystemApi = this.getApiSync('FeatureSystemApi');
await featureSystemApi.registerDynamic('basket');
basketAddressesApi = storefront.getApiSync('basketAddressesApi');
}
const isBillingAddressEqualShippingAddress$ = basketAddressesApi.selectIsBillingAddressEqualShippingAddress$();
isBillingAddressEqualShippingAddress$.subscribe((isBillingAddressEqualShippingAddress) => {
if (isBillingAddressEqualShippingAddress) {
// do something if addresses are equal
}
else {
// do something if addresses are not equal
}
})
});
Basket Address API methods reference¶
- getShippingAddress
- selectShippingAddress$
- setShippingAddress
- getBillingAddress
- selectBillingAddress$
- setBillingAddress
- isBillingAddressEqualShippingAddress
- isDifferentShippingAddressRequired
- selectIsDifferentShippingAddressRequired$
- setBillingAddressAsShippingAddress
- getSectionValidation
- selectSectionValidation$