Skip to content

isBillingAddressEqualShippingAddress(): boolean

The isBillingAddressEqualShippingAddress method allows to check if the billing address is equal to the shipping address.

Returned value

A returned value has a type of boolean indicating whether the addresses are 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 ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketAddressesApi = await getApi('basketAddressesApi');

        const isBillingAddressEqualShippingAddress = basketAddressesApi.isBillingAddressEqualShippingAddress();

        if (isBillingAddressEqualShippingAddress) {
            // do something if addresses are equal
        }
        else {
            // do something if addresses are not equal
        }
    });
});

Basket Address API methods reference