Last updated

decrementCartItem()

Decreases the quantity of an item in the cart. If quantity reaches zero, the item is removed.

Signature

await window.FairShareSDK.decrementCartItem(variantId, options);

Parameters

ParameterTypeDescription
variantIdnumberProduct variant ID
optionsobjectOptions object

Options:

PropertyTypeDescription
quantitynumberAmount to decrement (default: 1)

Example

// Decrease quantity by 1
await window.FairShareSDK.decrementCartItem(123, { quantity: 1 });

// Decrease quantity by 2
await window.FairShareSDK.decrementCartItem(123, { quantity: 2 });