Skip to content

select$(): Observable<BasketShipping[]>

The select$ method allows you to observe all basket shipping options.

Returned value

A returned value has a type of Observable<BasketShipping[]> where BasketShipping represents the BasketShipping model.

Example

In this example, we make a basketShippingsApi call to observe all basket shipping options.

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

        const basketShippingOptions$ = basketShippingsApi.select$();

        basketShippingOptions$.subscribe((shippingOptions) => {
            console.log('Available basket shipping options:', shippingOptions);
        });
    });
});

Basket Address API methods reference

Models reference