useCartRemoveItems

A cart hook that helps you easily remove multiple items from the cart.

// import
import { useCartRemoveItems } from '@backpackjs/storefront';

// instantiation
const { cartRemoveItems, ...removeItemsStatus } = useCartRemoveItems();

// use
const lineItemIds = cartItems.map(({ id }) => ({ id }));
const updatedCart = await cartRemoveItems(lineItemIds)

lineItemIds

An array of line item ids ['lineItemId', ...]

Each lineItemId

id

A valid line_item Id e.g Z2lkOi8vc2hvcGlmeS9DaGVja291dExpbmVJdGVtLzM5NjMwN...

Last updated