removeProductFromBasket
Removes a product item from the basket.
This method communicates with the removeProductFromBasket endpoint of the Vue Storefront API Middleware. In turn, it receives data from the removeProductFromBasket or the Remove product item from basket endpoints exposed by SCAPI / OCAPI depending on the middleware configuration.
Possible Responses 404 - BasketNotFoundException - Indicates that the basket with the given basket id is unknown. - ProductItemNotFoundException - Indicates that the product item with the given product item id is unknown.
Signature
export declare function removeProductFromBasket(
props: BasketProductRemoveParams & {
basketId?: string;
}
): Promise<import("commerce-sdk/dist/checkout/checkout").ShopperBaskets.Basket>;Parameters
| Name | Required | Type | Description |
|---|---|---|---|
props | Required | BasketProductRemoveParams & { basketId?: string; } | Parameter object which can be used with this method. Refer to its type definition to learn about possible properties. |
Returns
Returns a representation of a Category Hierarchy.
Referenced Types
BasketProductRemoveParamsShopperBaskets.Basket
Examples
Removing a product from basket by itemId.
import { sdk } from '~/sdk.config.ts';
const basketId (await sdk.commerce.getBasket()).basketId;
const cart = await sdk.commerce.removeProductFromBasket({
itemId: '001',
basketId: basketId,
});