Interface: AddItemOptions
Defined in: composables/react/useCart.ts:30
Arguments for UseCartReturn.addItem.
Properties
afterAddToCart?
optionalafterAddToCart?: (cart,item) =>void
Defined in: composables/react/useCart.ts:46
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:50
Explicit cart id to add into; defaults to the hook's resolved cart.
childItems?
optionalchildItems?:number[]
Defined in: composables/react/useCart.ts:36
Child product ids for bundle/cluster composite items.
cluster?
optionalcluster?:Cluster
Defined in: composables/react/useCart.ts:34
Cluster the product belongs to, when adding a configured cluster item.
createCart?
optionalcreateCart?:boolean
Defined in: composables/react/useCart.ts:52
When true and no cart exists, resolves/creates one before adding.
enableStockValidation?
optionalenableStockValidation?:boolean
Defined in: composables/react/useCart.ts:48
When true, rejects the add if product.inventory.totalQuantity is below quantity.
notes?
optionalnotes?:string
Defined in: composables/react/useCart.ts:40
Free-text line-item notes.
onAddToCart?
optionalonAddToCart?: (product,clusterId?,quantity?,childItems?,notes?,price?) =>Cart
Defined in: composables/react/useCart.ts:44
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
price?
optionalprice?:number
Defined in: composables/react/useCart.ts:42
Explicit unit price override.
product
product:
Product
Defined in: composables/react/useCart.ts:32
Product to add.
quantity
quantity:
number
Defined in: composables/react/useCart.ts:38
Quantity to add.