Update Cart Item
Change quantity or variant of a cart item.
Updated
Change quantity or variant of a cart item.
Updated
"use client"
import dash from "@/lib/dash"
export function QuantitySelector({ sizeId, currentQty, onUpdate }) {
async function changeQty(newQty: number) {
if (newQty 1) return
await dash.cart.update(sizeId, newQty)
onUpdate() // Refresh cart display
}
return (
<div className="flex items-center gap-2">
<button onClick={() => changeQty(currentQty - 1)}>-</button>
<span>{currentQty}</span>
<button onClick={() => changeQty(currentQty + 1)}>+</button>
</div>
)
}
POST /storefront/cart/{cart_id}/update
X-API-Key: pk_live_your_key
Content-Type: application/json
{
"size_id": "size_1g",
"quantity": 3
}