Skip to content

remove(product: ProductBasket): void

The remove method allows to remove an item from the basket.

Input parameters

product

product is a mandatory parameter of the ProductBasket type that represents the item we want to remove.

Returned value

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

Example

In this example we make a basketProductsApi call to remove a first item from the basket.

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

        const productsInBasket = basketProductsApi.get();

        basketProductsApi.remove(productsInBasket[0]);
    });
});

Basket Products API methods reference

Models reference