Skip to content

getShippingAddress(): Address | null

The getShippingAddress method allows to get a shipping address in a basket.

Returned value

A returned value has a type of Address | null where Address represents an address object.

Example

In this example we make a basketAddressesApi call to get a shipping address in the basket.

useStorefront(async ({ eventBus, getApi }) => {
    eventBus.on('basket.initialized', async () => {
        const basketAddressesApi = await getApi('basketAddressesApi');

        const shippingAddress = basketAddressesApi.getShippingAddress();
    });
});

Basket Address API methods reference

Models reference