> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Clear Cart

> Remove all items from the cart

# Clear Cart

Removes all line items from the cart. The cart itself (and its token) is
preserved, so the same token keeps working for subsequent `add` requests.

<Note>
  The cart is a **storefront**, cookie-based resource, not part of the OAuth
  `/api/v1` app API. Requests go to the shop's own domain (e.g.
  `https://mystore.launchmystore.io/cart/clear.js`) and the cart is identified by
  the `cart` cookie that the storefront sets — there is no `Authorization: Bearer`
  header. This mirrors the Shopify `/cart/clear.js` AJAX endpoint.
</Note>

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://mystore.launchmystore.io/cart/clear.js" \
    -H "Content-Type: application/json" \
    --cookie "cart=c1-YOUR_CART_TOKEN"
  ```

  ```javascript Browser (storefront) theme={null}
  const response = await fetch('/cart/clear.js', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' }
  });
  const cart = await response.json();
  ```
</CodeGroup>

## Body Parameters

No parameters required. The request body is ignored — `clearCart` only ever
deletes the cart's line items.

## Response

Returns the (now empty) cart as a bare Shopify-style cart object — not an
`{ status, data }` envelope.

<ResponseField name="token" type="string">
  The cart token (unchanged)
</ResponseField>

<ResponseField name="items" type="array">
  Line items — empty after a clear
</ResponseField>

<ResponseField name="item_count" type="integer">
  Number of items in the cart (0 after a clear)
</ResponseField>

<ResponseField name="total_price" type="integer">
  Cart total in the currency's smallest unit (cents)
</ResponseField>

<ResponseField name="currency" type="string">
  Presentment currency code
</ResponseField>

## Example Response

```json theme={null}
{
  "token": "c1-1a2b3c4d5e6f7890",
  "items": [],
  "item_count": 0,
  "total_price": 0,
  "items_subtotal_price": 0,
  "total_weight": 0,
  "currency": "USD",
  "requires_shipping": false,
  "note": "",
  "attributes": {}
}
```

## Errors

A failed clear returns the same bare Shopify-style body with an HTTP error
status and a `message`/`description`:

```json theme={null}
{
  "status": 422,
  "message": "Cart not found",
  "description": "Cart not found"
}
```
