useCartUpdateItems

A cart hook that helps you easily update multiple cart items

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

// instantiation
const { cartUpdateItems, ...updateItemsStatus } = useCartUpdateItems();

// use
const updatedCart = await cartUpdateItems(lineItems)

lineItems

An array of updated line items [{...lineItem}]

lineItem object

id

A valid line item Id e.g Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8yOTEwNjAyMjc5Mg==

quantity

An updated line item quantity (Integer)

customAttributes(optional)

line item custom attributes array

[ { key: 'attrKey', value: 'attrValue' }, ... ]

A hidden helper timestamp CustomAttribute _addedAt will be automatically added to each line item.

Last updated