Remove from Cart
Remove an item from the cart.
Updated
Remove all items at once:
const { message, cart } = await dash.cart.clear()
// Cart is now empty
Clear the SDK's local cart reference without touching the server:
dash.cart.reset()
// Clears cartId from localStorage — next add() creates a new cart
# 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
"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>
)
}