Skip to content

getSelectedShippingCountry(): ShippingCountry | undefined

The getSelectedShippingCountry method allows to retrieve the currently selected shipping country.

Returned value

A returned value has a type of ShippingCountry | undefined where ShippingCountry represents the ShippingCountry model.

Example

In this example we make a basketShippingsApi call to retrieve the currently selected shipping country.

useStorefront(async (storefront) => {
    let basketShippingsApi = storefront.getApiSync('basketShippingsApi');

    if (!basketShippingsApi) {
        const featureSystemApi = this.getApiSync(FEATURE_SYSTEM_API_NAME);
        await featureSystemApi.registerDynamic('basket');

        basketShippingsApi = storefront.getApiSync('basketShippingsApi');
    }

    const selectedShippingCountry = basketShippingsApi.getSelectedShippingCountry();
});

Basket Address API methods reference

Models reference