Skip to content

selectAvailableShippingCountries$(): Observable<Country[]>

The selectAvailableShippingCountries$ method allows to observe the available shipping countries.

Returned value

A returned value has a type of Country[] where Country represents the Country model.

Example

In this example we make a basketShippingsApi call to observe the available shipping countries.

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 availableShippingCountries$ = basketShippingsApi.selectAvailableShippingCountries$();

    availableShippingCountries$.subscribe((availableShippingCountries) => {
        console.log('currently available shipping countries:', availableShippingCountries);
    });
});

Basket Address API methods reference

Models reference