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

# Add Line Item

> Add a seller offer to the cart as a line item.

Adds an item to the cart by offer. Mercur resolves the offer's variant and stamps the `offer_id` on the line item so the cart can later split into per-seller orders.

> [!NOTE]
>
> Unlike vanilla Medusa, this route takes an `offer_id` instead of a `variant_id`; an unknown offer returns a `404`.

## Path parameters

**id** `string` *required*

The cart's ID.

## Body parameters

**offer\_id** `string` *required*

ID of the offer to add.

**quantity** `number` *required*

Quantity to add; must be a positive integer.

**unit\_price** `number`

Custom unit price overriding the offer's calculated price.

**compare\_at\_unit\_price** `number`

Compare-at unit price shown as the original price.

**metadata** `object`

Custom key-value data stored on the line item; `offer_id` is merged in automatically.

**additional\_data** `object`

Data passed to the add-to-cart workflow's hooks.

## Response

**cart** `object`

**properties**

**id** `string`

The cart's ID.

**currency\_code** `string`

The cart's currency.

**region\_id** `string`

The cart's region.

**email** `string | null`

The customer's email.

**items** `object[]`

Line items, each carrying `offer_id` in its `metadata`.

**shipping\_methods** `object[]`

Selected shipping methods.

**promotions** `object[]`

Applied promotions.

**shipping\_address** `object | null`

The shipping address.

**billing\_address** `object | null`

The billing address.

**payment\_collection** `object | null`

The cart's payment collection with its sessions.

**total** `number`

Cart total including tax and shipping.

**subtotal** `number`

Cart subtotal.

**tax\_total** `number`

Total tax amount.

**discount\_total** `number`

Total discount amount.

**shipping\_total** `number`

Total shipping amount.

```bash cURL theme={null}
curl -X POST 'http://localhost:9000/store/carts/cart_01JB2KB1CD/line-items' \
  -H 'Content-Type: application/json' \
  -H 'x-publishable-api-key: pk_01JB2K3XYZ' \
  -d '{"offer_id": "offer_01JB2K6G5H", "quantity": 1}'
```

```ts JS Client theme={null}
const { cart } = await client.store.carts.$id.lineItems.mutate({
  $id: "cart_01JB2KB1CD",
  offer_id: "offer_01JB2K6G5H",
  quantity: 1,
})
```

```json 200 theme={null}
{
  "cart": {
    "id": "cart_01JB2KB1CD",
    "currency_code": "eur",
    "region_id": "reg_01JB2K4S1T",
    "email": null,
    "items": [
      {
        "id": "cali_01JB2KB3EF",
        "title": "M",
        "product_title": "Linen Shirt",
        "quantity": 1,
        "unit_price": 4500,
        "metadata": { "offer_id": "offer_01JB2K6G5H" }
      }
    ],
    "shipping_methods": [],
    "promotions": [],
    "shipping_address": null,
    "billing_address": null,
    "payment_collection": null,
    "total": 4500,
    "subtotal": 4500,
    "tax_total": 0,
    "discount_total": 0,
    "shipping_total": 0
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.