Skip to content

getSelectedShipping(): BasketShipping | undefined

The getSelectedShipping method allows to retrieve the currently selected shipping option.

Returned value

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

Example

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

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

        const selectedShipping = basketShippingsApi.getSelectedShipping();
    });
});

Basket Address API methods reference

Models reference