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

# Get Cart

> Retrieve the current cart

# Get Cart

Returns the current cart for the visitor.

<Note>
  The cart 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

`GET /cart.js` returns the current cart as JSON. The cart is identified by
the `cart` cookie that the storefront sets on the first write action; send it
with the request (browsers do this automatically).

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://your-store.launchmystore.io/cart.js" \
    -H "Cookie: cart=c1-xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
  ```

  ```javascript Browser (fetch) theme={null}
  const response = await fetch('/cart.js', {
    headers: { 'Accept': 'application/json' }
  });
  const cart = await response.json();
  ```
</CodeGroup>

## Response

The response is the flat Shopify cart object. Money fields are integers in the
store's currency subunit (e.g. cents).

<ResponseField name="token" type="string">
  Unique cart token (matches the `cart` cookie)
</ResponseField>

<ResponseField name="items" type="array">
  Array of line items

  <Expandable title="Line Item">
    <ResponseField name="key" type="string">
      Line item key (`{variant_id}:{hash}` — used to target this line)
    </ResponseField>

    <ResponseField name="id" type="integer">
      Variant ID
    </ResponseField>

    <ResponseField name="variant_id" type="integer">
      Variant ID
    </ResponseField>

    <ResponseField name="product_id" type="integer">
      Product ID
    </ResponseField>

    <ResponseField name="title" type="string">
      Product title
    </ResponseField>

    <ResponseField name="variant_title" type="string">
      Variant title
    </ResponseField>

    <ResponseField name="quantity" type="integer">
      Quantity
    </ResponseField>

    <ResponseField name="price" type="integer">
      Price per item in the currency subunit
    </ResponseField>

    <ResponseField name="line_price" type="integer">
      Total line price in the currency subunit
    </ResponseField>

    <ResponseField name="sku" type="string">
      SKU
    </ResponseField>

    <ResponseField name="image" type="object">
      Product image
    </ResponseField>

    <ResponseField name="properties" type="object">
      Custom line item properties (key-value object)
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="item_count" type="integer">
  Total number of items
</ResponseField>

<ResponseField name="total_price" type="integer">
  Cart total in the currency subunit
</ResponseField>

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

<ResponseField name="requires_shipping" type="boolean">
  Whether any items require shipping
</ResponseField>

<ResponseField name="note" type="string">
  Cart note
</ResponseField>

<ResponseField name="attributes" type="object">
  Cart attributes (key-value pairs)
</ResponseField>

## Example Response

```json theme={null}
{
  "token": "c1-9a3f0c2e-7b1d-4e8a-9f2c-1a2b3c4d5e6f",
  "items": [
    {
      "key": "639664:default",
      "id": 639664,
      "product_id": 12001,
      "variant_id": 639664,
      "title": "Classic T-Shirt",
      "variant_title": "Medium / Black",
      "quantity": 2,
      "price": 2500,
      "line_price": 5000,
      "sku": "TSHIRT-M-BLK",
      "image": {
        "src": "https://assets.launchmystore.io/images/tshirt-black.jpg",
        "alt": "Black T-Shirt"
      },
      "properties": {},
      "requires_shipping": true,
      "taxable": true
    },
    {
      "key": "640001:7c1f9a2b3d4e",
      "id": 640001,
      "product_id": 12044,
      "variant_id": 640001,
      "title": "Baseball Cap",
      "variant_title": "One Size / Navy",
      "quantity": 1,
      "price": 1500,
      "line_price": 1500,
      "sku": "CAP-NAVY",
      "image": {
        "src": "https://assets.launchmystore.io/images/cap-navy.jpg",
        "alt": "Navy Baseball Cap"
      },
      "properties": {
        "Personalization": "John"
      },
      "requires_shipping": true,
      "taxable": true
    }
  ],
  "item_count": 3,
  "total_price": 6500,
  "currency": "USD",
  "requires_shipping": true,
  "note": "",
  "attributes": {}
}
```

An empty cart returns `item_count: 0` with an empty `items` array.

## Errors

If the store context cannot be resolved, the endpoint returns a
Shopify-style error body with the real HTTP status:

```json theme={null}
{
  "status": 400,
  "message": "Store context not found.",
  "description": "Missing store identifier"
}
```
