update-quantity Function
Updates the quantity of an order item ID in the cart.
The order item ID should be pulled from the id
field of the cart line item. This ID is temporarily the ECOM line item ID as the order item ID does not exist on Square before the cart is paid in full.
Example
fetch('/s/api/v1/cart/update-quantity', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': 'csrf_token_from_csrf_meta_tag',
},
body: JSON.stringify({
"order_id": "11ee580eac0364abafdd089e019fd17a",
"quantity": 24,
"order_item_id": "ORDER_ITEM_ID"
})
})
.then((response) => ...);
You can use the Site Theme SDK instead of calling the Cart API directly. The SDK is intended to simplify cart actions.