Skip to content

cleanBasket(): Promise<void>

The cleanBasket is an asynchronous method that allows to clear the products in the current basket.

Returned value

A returned value has a type of Promise<void> as this method returns nothing.

Example

In this example we make a basketOverallApi call to clear the products in the basket.

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

        await basketOverallApi.cleanBasket();
    });
});

Basket Overall API methods reference