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

# add_to_cart Event

> Track when a visitor adds an item to their cart

Fires when a visitor adds an item to their cart. This is one of the most important e-commerce events for tracking purchase intent and building audiences.

<Note>
  **Shopify:** Automatically tracked when using standard Shopify cart functionality.
</Note>

## JavaScript

```javascript theme={null}
window._upstack('track', 'add_to_cart', {
  items: [
    {
      id: 'SKU_12345',
      name: 'Classic Cotton Tee',
      price: 34.99,
      quantity: 2,
      variant: 'Blue / Medium',
      brand: 'Example Brand',
      category: 'Apparel/T-Shirts'
    }
  ],
  value: 69.98,
  currency: 'USD'
});
```

Minimal example:

```javascript theme={null}
window._upstack('track', 'add_to_cart', {
  items: [{ id: 'SKU_12345', name: 'Classic Cotton Tee', price: 34.99, quantity: 1 }],
  value: 34.99,
  currency: 'USD'
});
```

## Properties

| Property | Type   | Required | Description                                                            |
| -------- | ------ | -------- | ---------------------------------------------------------------------- |
| items    | array  | Yes      | Products added (see [Item Object](/pixel/standard-events#item-object)) |
| value    | number | Yes      | Total value of items added                                             |
| currency | string | Yes      | ISO 4217 currency code                                                 |

## When to Fire

* Add-to-cart button click
* Quantity increase in cart
* "Buy Now" button click (before checkout)

## Related Events

* [view\_content](/pixel/events/view-content) — View product before adding
* [product\_removed\_from\_cart](/pixel/events/product-removed-from-cart) — When removing from cart
* [view\_cart](/pixel/events/view-cart) — When viewing cart
* [initiate\_checkout](/pixel/events/initiate-checkout) — When starting checkout
