DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsCartUpdate Cart Item
Introduction
Getting Started
Authentication
Products
Categories
Cart
Get CartAdd to CartUpdate Cart ItemRemove from CartApply Discount CodeSubscription Cart Lines
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
Use Cases
Operations

Update Cart Item

Change quantity or variant of a cart item.

Updated March 29, 2026

On this page
  • Overview
  • SDK Usage
  • Quantity Selector Example
  • REST API
  • Next Steps

Overview

Update the quantity of an item already in the cart.

SDK Usage

typescript
import dash from "@/lib/dash"

// Set quantity to 3
await dash.cart.update("size_1g", 3)

The first argument is the sizeId of the item to update. The second is the new quantity.

Note: Setting quantity to 0 effectively removes the item. Use Remove from Cart for explicit removal.

Quantity Selector Example

typescript
"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>
  )
}

REST API

shell
POST /storefront/cart/{cart_id}/update
X-API-Key: pk_live_your_key
Content-Type: application/json

{
  "size_id": "size_1g",
  "quantity": 3
}

Next Steps

  • Remove from Cart — Remove items entirely
  • Get Cart — Refresh cart state after updates
PreviousAdd to CartNextRemove from Cart

On this page

  • Overview
  • SDK Usage
  • Quantity Selector Example
  • REST API
  • Next Steps