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.
Example
fetch('/s/api/v1/cart/update-quantity', {
method: 'POST',
headers: {
'X-CSRF-TOKEN': 'csrf_token_from_csrf_meta_tag',
},
body: JSON.stringify({
"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.