Interface: AddItemOptions
Defined in: composables/react/useCart.ts:45
Arguments for UseCartReturn.addItem.
Properties
afterAddToCart?
optionalafterAddToCart?: (cart,item) =>void
Defined in: composables/react/useCart.ts:61
Fires after the item is added — receives the updated cart and the matched line item.
Parameters
cart
Cart
item
CartMainItem | null
Returns
void
cartId?
optionalcartId?:string
Defined in: composables/react/useCart.ts:65
Explicit cart id to add into; defaults to the hook's resolved cart.
childItems?
optionalchildItems?:number[]
Defined in: composables/react/useCart.ts:51
Child product ids for bundle/cluster composite items.
cluster?
optionalcluster?:Cluster
Defined in: composables/react/useCart.ts:49
Cluster the product belongs to, when adding a configured cluster item.
createCart?
optionalcreateCart?:boolean
Defined in: composables/react/useCart.ts:67
When true and no cart exists, resolves/creates one before adding.
enableStockValidation?
optionalenableStockValidation?:boolean
Defined in: composables/react/useCart.ts:63
When true, rejects the add if product.inventory.totalQuantity is below quantity.
notes?
optionalnotes?:string
Defined in: composables/react/useCart.ts:55
Free-text line-item notes.
onAddToCart?
optionalonAddToCart?: (product,clusterId?,quantity?,childItems?,notes?,price?) =>Cart|Promise<Cart>
Defined in: composables/react/useCart.ts:59
Override: when provided, replaces the SDK call and returns the cart synchronously.
Parameters
product
Product
clusterId?
number
quantity?
number
childItems?
object[]
notes?
string
price?
number
Returns
Cart | Promise<Cart>
price?
optionalprice?:number
Defined in: composables/react/useCart.ts:57
Explicit unit price override.
product
product:
Product
Defined in: composables/react/useCart.ts:47
Product to add.
quantity
quantity:
number
Defined in: composables/react/useCart.ts:53
Quantity to add.