> ## 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.

# Remove from Cart

> Remove or change a cart item

# Remove from Cart

Removes an item from the cart or changes its quantity.

<Note>
  Cart change is a **storefront** surface, not part of the OAuth `/api/v1` app
  API. It follows the Shopify-AJAX cart contract: requests are made against the
  storefront origin (your store domain), identity is the `cart` cookie token
  (not a Bearer access token), and the response is the **flat** Shopify cart
  object — not wrapped in a `{ status, type, data }` envelope.
</Note>

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://your-store.launchmystore.io/cart/change.js" \
    -H "Content-Type: application/json" \
    -H "Cookie: cart=c1-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx" \
    -d '{
      "line": 1,
      "quantity": 0
    }'
  ```

  ```javascript Browser (fetch) theme={null}
  const response = await fetch('/cart/change.js', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      line: 1,
      quantity: 0  // Remove item
    })
  });
  const cart = await response.json();
  ```
</CodeGroup>

## Body Parameters

Use one of the following to identify the item:

<ParamField body="line" type="integer">
  Line item index (1-based)
</ParamField>

<ParamField body="id" type="string | integer">
  Variant ID of the line to change
</ParamField>

<ParamField body="key" type="string">
  Line item key (`{variant_id}:{hash}`, as returned in the cart `items`)
</ParamField>

<ParamField body="quantity" type="integer" required>
  New quantity. Set to `0` to remove the item.
</ParamField>

<ParamField body="properties" type="object">
  Update custom properties (when identifying by variant ID, properties help
  pinpoint the specific line item)
</ParamField>

<Note>
  A legacy browser pattern is also supported:
  `GET /cart/change?id={variantId}&quantity={qty}` (or `line=`). It applies the
  change and then redirects (HTTP 302) to `/cart`.
</Note>

## Response

The response is the flat Shopify cart object (the same shape returned by
[Get Cart](/api-reference/cart/get)), reflecting the updated cart after the
change.

## Example Response

```json theme={null}
{
  "token": "c1-9a3f0c2e-7b1d-4e8a-9f2c-1a2b3c4d5e6f",
  "items": [
    {
      "key": "640001:default",
      "id": 640001,
      "product_id": 12044,
      "variant_id": 640001,
      "title": "Baseball Cap",
      "variant_title": "One Size / Navy",
      "quantity": 1,
      "price": 1500,
      "line_price": 1500
    }
  ],
  "item_count": 1,
  "total_price": 1500,
  "currency": "USD",
  "note": "",
  "attributes": {}
}
```

## Remove by Variant ID

When the same variant appears multiple times (with different properties), use
properties to identify which one to change:

```json theme={null}
{
  "id": 640900,
  "quantity": 0,
  "properties": {
    "Engraving": "Happy Birthday!"
  }
}
```

## Errors

On failure the endpoint returns a Shopify-style error body with the real HTTP
status:

```json theme={null}
{
  "status": 404,
  "message": "Cart or line item not found",
  "description": "Cart or line item not found"
}
```
