DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsCartRemove from Cart
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

Remove from Cart

Remove an item from the cart.

Updated March 29, 2026

On this page
  • Overview
  • SDK Usage
  • Clear Entire Cart
  • Reset Local State
  • REST API
  • Cart Item with Remove Button
  • Next Steps

Overview

Remove a specific item from the cart by its size ID.

SDK Usage

typescript
import dash from "@/lib/dash"

const { message, cart } = await dash.cart.remove("size_1g")
// message = "Item removed"
// cart = updated cart state

Clear Entire Cart

Remove all items at once:

typescript
const { message, cart } = await dash.cart.clear()
// Cart is now empty

Reset Local State

Clear the SDK's local cart reference without touching the server:

typescript
dash.cart.reset()
// Clears cartId from localStorage — next add() creates a new cart

REST API

shell
# Remove single item
POST /storefront/cart/{cart_id}/remove/{size_id}
X-API-Key: pk_live_your_key

# Clear all items
POST /storefront/cart/{cart_id}/clear
X-API-Key: pk_live_your_key

Cart Item with Remove Button

typescript
"use client"
import dash from "@/lib/dash"

export function CartItem({ item, onUpdate }) {
  async function handleRemove() {
    await dash.cart.remove(item.size_id)
    onUpdate()
  }

  return (
    <div className="flex items-center justify-between">
      <div>
        <p>{item.product_name} — {item.size_label}</p>
        <p>${item.unit_price} × {item.quantity}</p>
      </div>
      <button onClick={handleRemove} className="text-red-500">Remove</button>
    </div>
  )
}

Next Steps

  • Apply Discount Code — Add a coupon to the cart
  • Create Order — Proceed to checkout
PreviousUpdate Cart ItemNextApply Discount Code

On this page

  • Overview
  • SDK Usage
  • Clear Entire Cart
  • Reset Local State
  • REST API
  • Cart Item with Remove Button
  • Next Steps