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
| Parameter | Type | Description |
|---|---|---|
variantId | number | Product variant ID |
options | object | Options object |
Options:
| Property | Type | Description |
|---|---|---|
quantity | number | Amount 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 });
Related
- updateCartItems — Set exact quantity
- removeCartItemById — Remove item completely