Skip to main content

Update item quantity in cart

PUT 

/api/v1/sdk/cart/store/:storeId/item

This endpoint updates the quantity of an existing cart item. Setting quantity to 0 removes the item from cart.

Authentication: Requires customer authentication (JWT token with verified phone). Optional API key for additional store validation.

Behavior:

  • If quantity is 0: Item is removed from cart
    • If quantity is positive: Item quantity is updated to the specified value
    • Inventory availability is validated before update
    • Cart totals are recalculated

Use Cases:

  • Updating quantities in cart UI
    • Removing items by setting quantity to 0
    • Cart optimization and cleanup

Error Scenarios:

  • 404 NOT FOUND - Cart item not found (Error code: CART_ITEM_NOT_FOUND)
    • 400 BAD REQUEST - Invalid quantity or insufficient stock (Error code: INVALID_QUANTITY or INSUFFICIENT_STOCK)
    • 401 UNAUTHORIZED - Customer not authenticated (Error code: UNAUTHORIZED)
    • 403 FORBIDDEN - API key doesn't have access to this store (Error code: NO_STORE_ACCESS)

Request​

Responses​

Cart item updated successfully