# Cart

The Cart API is used to interact with a cart during a customer's session. This guide shows how to use the Cart API to add, update, and delete cart line items, and update cart notes.

## Get the cart

```text
GET /{locale}/api/cart
```

Use the `GET /{locale}/api/cart` endpoint to get the cart as JSON.

All monetary properties are returned in the customer's presentment currency. To check the customer's presentment currency, you can use the currency field in the response when you have added other markets.

Below is a simplified `GET` request using the `fetch` API. The `Content-Type` should be set to `application/json` in the headers object. The response is the JSON of the line items associated.

### Example request

**Example request**

```javascript
fetch(window.SHOPLAZZA.routes.root + '/api/cart', {
  headers: {
    'Content-Type': 'application/json'
  }
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Response

**Schema | Example**

- `cart` object

  - `line_items` object[]

    List of line items.

    *   Array \[

    - `id` string

      ID of the line item.
    - `item_id` string
    - `product_id` string

      ID of the product.
    - `variant_id` string

      ID of the variant.
    - `quantity` string

      Quantity of the item.
    - `note` string

      Note attached to the line item.
    - `properties` string

      Custom properties of the line item, returned as a JSON string. Parse it before use.
    - `custom` boolean

      Whether the line item is a custom item.
    - `product_title` string

      Title of the product.
    - `product_handle` string

      Handle of the product.
    - `product_url` string

      Relative URL of the product page.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `product_type` string

      Product type.
    - `price` string

      Price of a single unit of the line item.
    - `compare_at_price` string

      Compare-at price of the item.
    - `origin_price` string
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `original_line_price` number

      Original price of the line item before discounts.
    - `saved_price` number

      Amount saved on this line item.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `fixed_discount_total` string
    - `discount_total` string

      Total discount applied.
    - `discount_id` string

      ID of the discount applied.
    - `available` boolean

      Whether the item can be purchased.
    - `available_quantity` number

      Quantity still available for purchase.
    - `can_buy` boolean

      Whether the variant of the line item can be sold.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `taxable` boolean

      Whether tax is charged.
    - `image` object

      Image of the line item's variant.

      - `src` string

        URL of the image.
      - `path` string

        Path of the image file on the image server.
      - `width` number

        Width of the image, in pixels.
      - `height` number

        Height of the image, in pixels.
      - `alt` string

        Alt text of the image.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `parts_price` string
    - `product_tags` undefined[]

      Tags of the product.
    - `published` boolean

      Whether the resource is published.
    - `published_at` string

      Publication time, in ISO-8601 format.
    - `inventory_quantity` number

      Inventory quantity.
    - `inventory_policy` string

      Whether the product keeps selling when it is out of stock.
    - `inventory_tracking` boolean

      Whether inventory tracking is enabled.
    - `cost_price` string

      Cost price of the variant.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `barcode` string

      Barcode of the variant.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `tax_code` string
    - `retail_price` string

      Retail price in the store's main currency unit.
    - `item_text` string
    - `disabled` boolean
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `custom_discounts` undefined[]
    *   \]
  - `ineffectives` undefined[]

    Line items in the cart that can no longer be purchased.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `attributes` undefined[]
  - `total_discount` string

    Total amount saved by all discounts on the cart.
  - `discount_line_item_price` string

    Discounted total for the applied discounts.
  - `currency` string

    Currency of the cart, for example `USD`.
  - `original_line_price` string

    Original price of the line item before discounts.
  - `original_total_price` string

    Total price of the cart before any discounts.
  - `line_price` string

    Combined price of all units in this line item, before discounts.
  - `total_price` string

    Total price of the cart after discounts.
  - `note` string

    Note attached to the object.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `item_count` number

    Number of items in the cart.
  - `total_weight` number

    Total weight of all items in the cart.
  - `invalid_msg` string
  - `identity_cart_id` string

    Identifier of the cart. Use it to link a cart to the order it becomes.
  - `user_id` string

    ID of the signed-in customer. Absent for guests.

```json
{
  "cart": {
    "line_items": [
      {
        "id": "684953787470717063_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684953787470717063",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "quantity": "1",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "sample-product",
        "product_handle": "sample-product",
        "product_url": "/products/sample-product",
        "variant_title": "01",
        "product_type": "default",
        "price": "1.00",
        "compare_at_price": "1.00",
        "origin_price": "1.00",
        "line_price": "1.00",
        "original_line_price": 1,
        "saved_price": 0,
        "final_line_price": "1.00",
        "final_price": "1.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 999999999,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "",
        "spu": "",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000,
          "height": 1500,
          "alt": ""
        },
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-08-10T07:28:24Z",
        "inventory_quantity": 0,
        "inventory_policy": "",
        "inventory_tracking": false,
        "cost_price": "1.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      }
    ],
    "ineffectives": [],
    "discount_applications": [],
    "attributes": [],
    "total_discount": "0.00",
    "discount_line_item_price": "0.00",
    "currency": "USD",
    "original_line_price": "1.00",
    "original_total_price": "1.00",
    "line_price": "1.00",
    "total_price": "1.00",
    "note": "",
    "created_at": "2026-09-03T01:03:36Z",
    "updated_at": "2026-09-03T02:41:50Z",
    "item_count": 1,
    "total_weight": 0,
    "invalid_msg": "",
    "identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
    "user_id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5"
  }
}
```

## Add a variant to the cart

```text
POST /{locale}/api/cart
```

Use the `POST /{locale}/api/cart` endpoint to add a single variant to the cart.

### Example request

If an item is already in the cart, then `quantity` is added to the current quantity for that item.

**Example request**

```javascript
const data = {
  product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
  variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
  quantity: 1,
  refer_info: {
    source: "add_to_cart"
  },
  properties: {
    Engraving: "Happy Birthday",
    _design_id: "dsg_8f21c"
  }
};

fetch(window.SHOPLAZZA.routes.root + '/api/cart', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  })
	.catch((error) => {
    console.error('Error: ', error);
  });
```

### Request parameters

**Schema | Example**

- `product_id` string

  The product id of the variant.
- `quantity` number

  The quantity that needs to add to the cart.
- `variant_id` string

  The variant id.
- `refer_info` object

  The refer info for the source of the request. It has a `source` property that possible values: `add_to_cart`, `buy_now`, or `cart`.

  - `source` string
- `properties` object

  Custom properties to attach to the line item, such as customization options. They stay on the line item through to the order.

```json
{
  "product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
  "variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
  "quantity": 1,
  "refer_info": {
    "source": "add_to_cart"
  },
  "properties": {
    "Engraving": "Happy Birthday",
    "_design_id": "dsg_8f21c"
  }
}
```

**note**

A line item is identified by its variant together with its properties. Adding the same variant with different properties creates a second line item instead of increasing the quantity of the first one.

In responses, `properties` comes back as a JSON string, so parse it before reading keys. A line added without properties comes back as an empty string, so check for a value first and guard against a parsed result that is not a plain object.

A key that starts with an underscore is still returned by this API, but it is never displayed to the shopper or in the admin. For the full flow, from writing properties on the product page to reading them back off the order, see [Add custom properties to cart and orders](/docs/app/use-cases/product-merchandising/add-custom-properties).

### Response

**Schema | Example**

- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.
- `data` object

  The response payload.

  - `items` object[]

    List of line items in the cart.

    *   Array \[

    - `id` string

      ID of the line item.
    - `item_id` string
    - `product_id` string

      ID of the product.
    - `variant_id` string

      ID of the variant.
    - `quantity` number

      Quantity of the item.
    - `note` string

      Note attached to the line item.
    - `properties` string

      Custom properties of the line item, returned as a JSON string. Parse it before use.
    - `custom` boolean

      Whether the line item is a custom item.
    - `product_title` string

      Title of the product.
    - `product_handle` string

      Handle of the product.
    - `product_url` string

      Relative URL of the product page.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `product_type` string

      Product type.
    - `price` string

      Price of a single unit of the line item.
    - `compare_at_price` string

      Compare-at price of the item.
    - `origin_price` string
    - `available` boolean

      Whether the item can be purchased.
    - `available_quantity` number

      Quantity still available for purchase.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `taxable` boolean

      Whether tax is charged.
    - `image` object

      Image of the line item's variant.

      - `src` string

        URL of the image.
      - `path` string

        Path of the image file on the image server.
      - `width` number

        Width of the image, in pixels.
      - `height` number

        Height of the image, in pixels.
      - `alt` string

        Alt text of the image.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `product_tags` undefined[]

      Tags of the product.
    - `published` boolean

      Whether the resource is published.
    - `published_at` string

      Publication time, in ISO-8601 format.
    - `inventory_quantity` number

      Inventory quantity.
    - `inventory_policy` string

      Whether the product keeps selling when it is out of stock.
    - `inventory_tracking` boolean

      Whether inventory tracking is enabled.
    - `cost_price` string

      Cost price of the variant.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `barcode` string

      Barcode of the variant.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `tax_code` string
    - `retail_price` string

      Retail price in the store's main currency unit.
    - `add_quantity` string
    - `disabled` boolean
    *   \]

```json
{
  "state": "success",
  "message": "",
  "errors": [],
  "data": {
    "items": [
      {
        "id": "0_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684953787470717063",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "quantity": 1,
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "sample-product",
        "product_handle": "sample-product",
        "product_url": "/products/sample-product",
        "variant_title": "01",
        "product_type": "default",
        "price": "1.00",
        "compare_at_price": "1.00",
        "origin_price": "1.00",
        "available": true,
        "available_quantity": 999999999,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "",
        "spu": "",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000,
          "height": 1500,
          "alt": ""
        },
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "product_tags": [],
        "published": true,
        "published_at": "2026-08-10T07:28:24Z",
        "inventory_quantity": 0,
        "inventory_policy": "",
        "inventory_tracking": false,
        "cost_price": "1.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "add_quantity": "1",
        "disabled": false
      }
    ]
  }
}
```

## Add one or more variants to the cart

```text
POST /{locale}/api/cart/batch
```

Use the `POST /{locale}/api/cart/batch` endpoint to add one or multiple variants to the cart.

### Example request

If an item is already in the cart, then `quantity` is added to the current quantity for that item.

**Example request**

```javascript
const data = {
  line_items: [
    {
      product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
      variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
      quantity: 1,
      properties: {
        Engraving: "Happy Birthday"
      }
    },
    {
      quantity: 2,
      product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
      variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
    }
  ]
}

fetch(window.SHOPLAZZA.routes.root + '/api/cart/batch', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  })
  .catch((error) => {
    console.error('Error: ', error);
  });
```

### Request parameters

**Schema | Example**

- `line_items` object[]

  List of line items.

  *   Array \[

  - `product_id` string

    ID of the product to add.
  - `variant_id` string

    ID of the variant to add.
  - `quantity` number

    Quantity to add.
  - `properties` object

    Custom properties to attach to the line item.
  *   \]

```json
{
  "line_items": [
    {
      "product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
      "variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
      "quantity": 1,
      "properties": {
        "Engraving": "Happy Birthday"
      }
    },
    {
      "quantity": 2,
      "product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
      "variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
    }
  ]
}
```

### Response

**Schema | Example**

- `items` object[]

  List of line items in the cart.

  *   Array \[

  - `id` string

    ID of the line item.
  - `item_id` string
  - `product_id` string

    ID of the product.
  - `variant_id` string

    ID of the variant.
  - `quantity` number

    Quantity of the item.
  - `note` string

    Note attached to the line item.
  - `properties` string

    Custom properties captured on the line item.
  - `custom` boolean

    Whether the line item is a custom item.
  - `product_title` string

    Title of the product.
  - `product_handle` string

    Handle of the product.
  - `product_url` string

    Relative URL of the product page.
  - `variant_title` string

    Title of the variant, for example `Blue, Size M`.
  - `product_type` string

    Product type.
  - `price` string

    Price of a single unit of the line item.
  - `compare_at_price` string

    Compare-at price of the item.
  - `origin_price` string
  - `available` boolean

    Whether the item can be purchased.
  - `available_quantity` number

    Quantity still available for purchase.
  - `weight` string

    Weight of the variant.
  - `weight_unit` string

    Unit of the weight, for example `kg`.
  - `sku` string

    SKU of the variant, used for inventory tracking.
  - `spu` string

    SPU of the product.
  - `requires_shipping` boolean

    Whether shipping is required.
  - `taxable` boolean

    Whether tax is charged.
  - `image` object

    Image of the line item's variant.

    - `src` string

      URL of the image.
    - `path` string

      Path of the image file on the image server.
    - `width` number

      Width of the image, in pixels.
    - `height` number

      Height of the image, in pixels.
    - `alt` string

      Alt text of the image.
  - `options` object[]

    Option values of the line item's variant.

    *   Array \[

    - `name` string

      Name of the product option, for example `Color`.
    - `value` string

      Value selected for this product option.
    *   \]
  - `wholesale_price` object[]

    Wholesale price tiers.

    *   Array \[

    - `min_quantity` number

      Minimum quantity required for this wholesale tier.
    - `price` string

      Unit price of this wholesale tier.
    *   \]
  - `product_tags` undefined[]

    Tags of the product.
  - `published` boolean

    Whether the resource is published.
  - `published_at` string

    Publication time, in ISO-8601 format.
  - `inventory_quantity` number

    Inventory quantity.
  - `inventory_policy` string

    Whether the product keeps selling when it is out of stock.
  - `inventory_tracking` boolean

    Whether inventory tracking is enabled.
  - `cost_price` string

    Cost price of the variant.
  - `vendor` string

    Vendor of the product.
  - `vendor_url` string

    URL of the product vendor.
  - `barcode` string

    Barcode of the variant.
  - `mixed_wholesale` boolean

    Whether mixed wholesale is supported.
  - `tax_code` string
  - `retail_price` string

    Retail price in the store's main currency unit.
  - `add_quantity` string
  - `disabled` boolean
  *   \]

```json
{
  "items": [
    {
      "id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
      "item_id": "684765446766863303",
      "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
      "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
      "quantity": 2,
      "note": "",
      "properties": "",
      "custom": false,
      "product_title": "sample-product",
      "product_handle": "sample-product",
      "product_url": "/products/sample-product",
      "variant_title": "01",
      "product_type": "default",
      "price": "1.00",
      "compare_at_price": "1.00",
      "origin_price": "1.00",
      "available": true,
      "available_quantity": 999999999,
      "weight": "0.00",
      "weight_unit": "kg",
      "sku": "",
      "spu": "",
      "requires_shipping": true,
      "taxable": false,
      "image": {
        "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
        "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
        "width": 3000,
        "height": 1500,
        "alt": ""
      },
      "options": [
        {
          "name": "Size",
          "value": "01"
        }
      ],
      "wholesale_price": [
        {
          "min_quantity": 1,
          "price": "1.00"
        }
      ],
      "product_tags": [],
      "published": true,
      "published_at": "2026-08-10T07:28:24Z",
      "inventory_quantity": 0,
      "inventory_policy": "",
      "inventory_tracking": false,
      "cost_price": "1.00",
      "vendor": "",
      "vendor_url": "",
      "barcode": "",
      "mixed_wholesale": false,
      "tax_code": "",
      "retail_price": "0.00",
      "add_quantity": "1",
      "disabled": false
    }
  ]
}
```

## Set the quantity of several line items

```text
POST /{locale}/api/cart/update
```

Use the `POST /{locale}/api/cart/update` endpoint to set the quantity of one or more line items that are already in the cart. Unlike `POST /{locale}/api/cart`, the quantity you send replaces the current quantity instead of being added to it.

### Example request

**Example request**

```javascript
const data = {
  line_items: [
    {
      product_id: "b1ab6324-ae4f-4cca-907e-18af16839447",
      variant_id: "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
      quantity: 1
    }
  ]
};

fetch(window.SHOPLAZZA.routes.root + '/api/cart/update', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Request parameters

**Schema | Example**

- `line_items` object[]

  The line items to update.

  *   Array \[

  - `product_id` string

    The product id of the variant.
  - `variant_id` string

    The variant id.
  - `quantity` number

    The new quantity of the line item.
  *   \]

```json
{
  "line_items": [
    {
      "product_id": "b1ab6324-ae4f-4cca-907e-18af16839447",
      "variant_id": "4a3d825c-2fac-4f72-a68b-b8604b0935c4",
      "quantity": 1
    }
  ]
}
```

### Response

**Schema | Example**

- `cart` object

  - `line_items` object[]

    List of line items.

    *   Array \[

    - `id` string

      ID of the line item.
    - `item_id` string
    - `product_id` string

      ID of the product.
    - `variant_id` string

      ID of the variant.
    - `quantity` string

      Quantity of the item.
    - `note` string

      Note attached to the line item.
    - `properties` string

      Custom properties captured on the line item.
    - `custom` boolean

      Whether the line item is a custom item.
    - `product_title` string

      Title of the product.
    - `product_handle` string

      Handle of the product.
    - `product_url` string

      Relative URL of the product page.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `product_type` string

      Product type.
    - `price` string

      Price of a single unit of the line item.
    - `compare_at_price` string

      Compare-at price of the item.
    - `origin_price` string
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `original_line_price` number

      Original price of the line item before discounts.
    - `saved_price` number

      Amount saved on this line item.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `fixed_discount_total` string
    - `discount_total` string

      Total discount applied.
    - `discount_id` string

      ID of the discount applied.
    - `available` boolean

      Whether the item can be purchased.
    - `available_quantity` number

      Quantity still available for purchase.
    - `can_buy` boolean

      Whether the variant of the line item can be sold.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `taxable` boolean

      Whether tax is charged.
    - `image` object

      Image of the line item's variant.

      - `src` string

        URL of the image.
      - `path` string

        Path of the image file on the image server.
      - `width` number

        Width of the image, in pixels.
      - `height` number

        Height of the image, in pixels.
      - `alt` string

        Alt text of the image.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `parts_price` string
    - `product_tags` undefined[]

      Tags of the product.
    - `published` boolean

      Whether the resource is published.
    - `published_at` string

      Publication time, in ISO-8601 format.
    - `inventory_quantity` number

      Inventory quantity.
    - `inventory_policy` string

      Whether the product keeps selling when it is out of stock.
    - `inventory_tracking` boolean

      Whether inventory tracking is enabled.
    - `cost_price` string

      Cost price of the variant.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `barcode` string

      Barcode of the variant.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `tax_code` string
    - `retail_price` string

      Retail price in the store's main currency unit.
    - `item_text` string
    - `disabled` boolean
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `custom_discounts` undefined[]
    *   \]
  - `ineffectives` undefined[]

    Line items in the cart that can no longer be purchased.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `attributes` undefined[]
  - `total_discount` string

    Total amount saved by all discounts on the cart.
  - `discount_line_item_price` string

    Discounted total for the applied discounts.
  - `currency` string

    Currency of the cart, for example `USD`.
  - `original_line_price` string

    Original price of the line item before discounts.
  - `original_total_price` string

    Total price of the cart before any discounts.
  - `line_price` string

    Combined price of all units in this line item, before discounts.
  - `total_price` string

    Total price of the cart after discounts.
  - `note` string

    Note attached to the object.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `item_count` number

    Number of items in the cart.
  - `total_weight` number

    Total weight of all items in the cart.
  - `invalid_msg` string
  - `identity_cart_id` string

    Identifier of the cart. Use it to link a cart to the order it becomes.
  - `user_id` string

```json
{
  "cart": {
    "line_items": [
      {
        "id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684765446766863303",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "quantity": "1",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "sample-product",
        "product_handle": "sample-product",
        "product_url": "/products/sample-product",
        "variant_title": "01",
        "product_type": "default",
        "price": "1.00",
        "compare_at_price": "1.00",
        "origin_price": "1.00",
        "line_price": "1.00",
        "original_line_price": 1,
        "saved_price": 0,
        "final_line_price": "1.00",
        "final_price": "1.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 999999999,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "",
        "spu": "",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000,
          "height": 1500,
          "alt": ""
        },
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-08-10T07:28:24Z",
        "inventory_quantity": 0,
        "inventory_policy": "",
        "inventory_tracking": false,
        "cost_price": "1.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      },
      {
        "id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684698318307074183",
        "product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
        "variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
        "quantity": "2",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "Sample product",
        "product_handle": "Sample product",
        "product_url": "/products/Sample product",
        "variant_title": "Black-S",
        "product_type": "default",
        "price": "10.00",
        "compare_at_price": "20.00",
        "origin_price": "10.00",
        "line_price": "20.00",
        "original_line_price": 40,
        "saved_price": 10,
        "final_line_price": "20.00",
        "final_price": "10.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 48,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "1111-BLACK-S-A001001",
        "spu": "1111",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "width": 1254,
          "height": 1254,
          "alt": ""
        },
        "options": [
          {
            "name": "Color",
            "value": "Black"
          },
          {
            "name": "Size",
            "value": "S"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "10.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-07-30T02:28:23Z",
        "inventory_quantity": 48,
        "inventory_policy": "deny",
        "inventory_tracking": true,
        "cost_price": "10.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      }
    ],
    "ineffectives": [],
    "discount_applications": [],
    "attributes": [],
    "total_discount": "0.00",
    "discount_line_item_price": "0.00",
    "currency": "USD",
    "original_line_price": "41.00",
    "original_total_price": "41.00",
    "line_price": "21.00",
    "total_price": "21.00",
    "note": "",
    "created_at": "2026-06-23T19:57:16Z",
    "updated_at": "2026-09-02T14:13:29Z",
    "item_count": 3,
    "total_weight": 0,
    "invalid_msg": "",
    "identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
    "user_id": ""
  }
}
```

## Set the quantity of one line item

```text
PATCH /{locale}/api/cart/{variant_id}
```

Use the `PATCH /{locale}/api/cart/{variant_id}` endpoint to update the cart's line item quantities.

### Example request

If an item is already in the cart, then `quantity` is equal to the new quantity quantity for that item.

**Example request**

```javascript
const data = {
  id: "298422_d41d8cd98f00b204e9800998ecf8427e",
  product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
  variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
  quantity: 3,
  properties: {
    Engraving: "Happy Anniversary"
  }
};

fetch(window.SHOPLAZZA.routes.root + '/api/cart/83196e5a-b25f-42c3-8df5-359d83ea7ae8', {
  method: 'PATCH',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  })
  .catch((error) => {
    console.error('Error: ', error);
  });
```

### Request parameters

**Schema | Example**

- `variant_id` string

  ID of the variant. Send it in the path and in the request body.
- `id` string

  ID of the line item to update, taken from the `id` of a line item in the cart.
- `product_id` string

  ID of the product.
- `quantity` number

  Quantity of the item.
- `properties` object

  Custom properties of the line item. What you send replaces the properties the line item already has.

```json
{
  "id": "298422_d41d8cd98f00b204e9800998ecf8427e",
  "product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
  "variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
  "quantity": 3,
  "properties": {
    "Engraving": "Happy Anniversary"
  }
}
```

### Response

**Schema | Example**

- `cart` object

  - `line_items` object[]

    List of line items.

    *   Array \[

    - `id` string

      ID of the line item.
    - `item_id` string
    - `product_id` string

      ID of the product.
    - `variant_id` string

      ID of the variant.
    - `quantity` string

      Quantity of the item.
    - `note` string

      Note attached to the line item.
    - `properties` string

      Custom properties captured on the line item.
    - `custom` boolean

      Whether the line item is a custom item.
    - `product_title` string

      Title of the product.
    - `product_handle` string

      Handle of the product.
    - `product_url` string

      Relative URL of the product page.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `product_type` string

      Product type.
    - `price` string

      Price of a single unit of the line item.
    - `compare_at_price` string

      Compare-at price of the item.
    - `origin_price` string
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `original_line_price` number

      Original price of the line item before discounts.
    - `saved_price` number

      Amount saved on this line item.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `fixed_discount_total` string
    - `discount_total` string

      Total discount applied.
    - `discount_id` string

      ID of the discount applied.
    - `available` boolean

      Whether the item can be purchased.
    - `available_quantity` number

      Quantity still available for purchase.
    - `can_buy` boolean

      Whether the variant of the line item can be sold.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `taxable` boolean

      Whether tax is charged.
    - `image` object

      Image of the line item's variant.

      - `src` string

        URL of the image.
      - `path` string

        Path of the image file on the image server.
      - `width` number

        Width of the image, in pixels.
      - `height` number

        Height of the image, in pixels.
      - `alt` string

        Alt text of the image.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `parts_price` string
    - `product_tags` undefined[]

      Tags of the product.
    - `published` boolean

      Whether the resource is published.
    - `published_at` string

      Publication time, in ISO-8601 format.
    - `inventory_quantity` number

      Inventory quantity.
    - `inventory_policy` string

      Whether the product keeps selling when it is out of stock.
    - `inventory_tracking` boolean

      Whether inventory tracking is enabled.
    - `cost_price` string

      Cost price of the variant.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `barcode` string

      Barcode of the variant.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `tax_code` string
    - `retail_price` string

      Retail price in the store's main currency unit.
    - `item_text` string
    - `disabled` boolean
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `custom_discounts` undefined[]
    *   \]
  - `ineffectives` undefined[]

    Line items in the cart that can no longer be purchased.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `attributes` undefined[]
  - `total_discount` string

    Total amount saved by all discounts on the cart.
  - `discount_line_item_price` string

    Discounted total for the applied discounts.
  - `currency` string

    Currency of the cart, for example `USD`.
  - `original_line_price` string

    Original price of the line item before discounts.
  - `original_total_price` string

    Total price of the cart before any discounts.
  - `line_price` string

    Combined price of all units in this line item, before discounts.
  - `total_price` string

    Total price of the cart after discounts.
  - `note` string

    Note attached to the object.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `item_count` number

    Number of items in the cart.
  - `total_weight` number

    Total weight of all items in the cart.
  - `invalid_msg` string
  - `identity_cart_id` string

    Identifier of the cart. Use it to link a cart to the order it becomes.
  - `user_id` string

```json
{
  "cart": {
    "line_items": [
      {
        "id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684765446766863303",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "quantity": "2",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "sample-product",
        "product_handle": "sample-product",
        "product_url": "/products/sample-product",
        "variant_title": "01",
        "product_type": "default",
        "price": "1.00",
        "compare_at_price": "1.00",
        "origin_price": "1.00",
        "line_price": "2.00",
        "original_line_price": 2,
        "saved_price": 0,
        "final_line_price": "2.00",
        "final_price": "1.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 999999999,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "",
        "spu": "",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000,
          "height": 1500,
          "alt": ""
        },
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-08-10T07:28:24Z",
        "inventory_quantity": 0,
        "inventory_policy": "",
        "inventory_tracking": false,
        "cost_price": "1.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      },
      {
        "id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684698318307074183",
        "product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
        "variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
        "quantity": "2",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "Sample product",
        "product_handle": "Sample product",
        "product_url": "/products/Sample product",
        "variant_title": "Black-S",
        "product_type": "default",
        "price": "10.00",
        "compare_at_price": "20.00",
        "origin_price": "10.00",
        "line_price": "20.00",
        "original_line_price": 40,
        "saved_price": 10,
        "final_line_price": "20.00",
        "final_price": "10.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 48,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "1111-BLACK-S-A001001",
        "spu": "1111",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "width": 1254,
          "height": 1254,
          "alt": ""
        },
        "options": [
          {
            "name": "Color",
            "value": "Black"
          },
          {
            "name": "Size",
            "value": "S"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "10.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-07-30T02:28:23Z",
        "inventory_quantity": 48,
        "inventory_policy": "deny",
        "inventory_tracking": true,
        "cost_price": "10.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      }
    ],
    "ineffectives": [],
    "discount_applications": [],
    "attributes": [],
    "total_discount": "0.00",
    "discount_line_item_price": "0.00",
    "currency": "USD",
    "original_line_price": "42.00",
    "original_total_price": "42.00",
    "line_price": "22.00",
    "total_price": "22.00",
    "note": "",
    "created_at": "2026-06-23T19:57:16Z",
    "updated_at": "2026-09-02T14:13:27Z",
    "item_count": 4,
    "total_weight": 0,
    "invalid_msg": "",
    "identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
    "user_id": ""
  }
}
```

## Remove a line item from the cart

```text
DELETE /{locale}/api/cart/{variant_id}
```

Use the `DELETE /{locale}/api/cart/{variant_id}` endpoint to remove a line item.

### Example request

**Example request**

```javascript
const data = {
  id: "298422_d41d8cd98f00b204e9800998ecf8427e",
  product_id: "588ed0ce-40af-44c7-8dea-afa18b489ef8",
  variant_id: "83196e5a-b25f-42c3-8df5-359d83ea7ae8",
};

fetch(window.SHOPLAZZA.routes.root + '/api/cart/83196e5a-b25f-42c3-8df5-359d83ea7ae8', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  })
  .catch((error) => {
    console.error('Error: ', error);
  });
```

### Request parameters

**Schema | Example**

- `variant_id` string

  ID of the variant. Send it in the path and in the request body.
- `id` string

  ID of the line item to remove, taken from the `id` of a line item in the cart.
- `product_id` string

  ID of the product.

```json
{
  "id": "298422_d41d8cd98f00b204e9800998ecf8427e",
  "product_id": "588ed0ce-40af-44c7-8dea-afa18b489ef8",
  "variant_id": "83196e5a-b25f-42c3-8df5-359d83ea7ae8"
}
```

### Response

**Schema | Example**

- `cart` object

  - `line_items` undefined[]

    List of line items.
  - `ineffectives` undefined[]

    Line items in the cart that can no longer be purchased.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `attributes` undefined[]
  - `total_discount` string

    Total amount saved by all discounts on the cart.
  - `discount_line_item_price` string

    Discounted total for the applied discounts.
  - `currency` string

    Currency of the cart, for example `USD`.
  - `original_line_price` string

    Original price of the line item before discounts.
  - `original_total_price` string

    Total price of the cart before any discounts.
  - `line_price` string

    Combined price of all units in this line item, before discounts.
  - `total_price` string

    Total price of the cart after discounts.
  - `note` string

    Note attached to the object.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `item_count` number

    Number of items in the cart.
  - `total_weight` number

    Total weight of all items in the cart.
  - `invalid_msg` string
  - `identity_cart_id` string

    Identifier of the cart. Use it to link a cart to the order it becomes.
  - `user_id` string

```json
{
  "cart": {
    "line_items": [],
    "ineffectives": [],
    "discount_applications": [],
    "attributes": [],
    "total_discount": "0.00",
    "discount_line_item_price": "0.00",
    "currency": "USD",
    "original_line_price": "0.00",
    "original_total_price": "0.00",
    "line_price": "0.00",
    "total_price": "0.00",
    "note": "",
    "created_at": "2026-09-03T01:03:36Z",
    "updated_at": "2026-09-03T02:41:51Z",
    "item_count": 0,
    "total_weight": 0,
    "invalid_msg": "",
    "identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
    "user_id": "9fe44049-abab-4fed-ab3d-1bf4ffee8ef5"
  }
}
```

## Select which line items are checked out

```text
POST /{locale}/api/cart/cart-select
```

Use the `POST /{locale}/api/cart/cart-select` endpoint to choose which line items of the cart are selected for checkout. Line items that are not in `selected_cart_ids` become unselected.

### Example request

**Example request**

```javascript
const data = {
  selected_cart_ids: ["684765446766863303_d41d8cd98f00b204e9800998ecf8427e"]
};

fetch(window.SHOPLAZZA.routes.root + '/api/cart/cart-select', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify(data)
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Request parameters

**Schema | Example**

- `selected_cart_ids` string[]

  The ids of the line items to select, as returned in `id`.

```json
{
  "selected_cart_ids": [
    "684765446766863303_d41d8cd98f00b204e9800998ecf8427e"
  ]
}
```

### Response

**Schema | Example**

- `cart` object

  - `line_items` object[]

    List of line items.

    *   Array \[

    - `id` string

      ID of the line item.
    - `item_id` string
    - `product_id` string

      ID of the product.
    - `variant_id` string

      ID of the variant.
    - `quantity` string

      Quantity of the item.
    - `note` string

      Note attached to the line item.
    - `properties` string

      Custom properties captured on the line item.
    - `custom` boolean

      Whether the line item is a custom item.
    - `product_title` string

      Title of the product.
    - `product_handle` string

      Handle of the product.
    - `product_url` string

      Relative URL of the product page.
    - `variant_title` string

      Title of the variant, for example `Blue, Size M`.
    - `product_type` string

      Product type.
    - `price` string

      Price of a single unit of the line item.
    - `compare_at_price` string

      Compare-at price of the item.
    - `origin_price` string
    - `line_price` string

      Combined price of all units in this line item, before discounts.
    - `original_line_price` number

      Original price of the line item before discounts.
    - `saved_price` number

      Amount saved on this line item.
    - `final_line_price` string

      Combined price of all units in this line item, after line-level discounts.
    - `final_price` string

      Price of a single unit of this line item, after line-level discounts.
    - `discount_applications` undefined[]

      Discounts applied to this object.
    - `fixed_discount_total` string
    - `discount_total` string

      Total discount applied.
    - `discount_id` string

      ID of the discount applied.
    - `available` boolean

      Whether the item can be purchased.
    - `available_quantity` number

      Quantity still available for purchase.
    - `can_buy` boolean

      Whether the variant of the line item can be sold.
    - `weight` string

      Weight of the variant.
    - `weight_unit` string

      Unit of the weight, for example `kg`.
    - `sku` string

      SKU of the variant, used for inventory tracking.
    - `spu` string

      SPU of the product.
    - `requires_shipping` boolean

      Whether shipping is required.
    - `taxable` boolean

      Whether tax is charged.
    - `image` object

      Image of the line item's variant.

      - `src` string

        URL of the image.
      - `path` string

        Path of the image file on the image server.
      - `width` number

        Width of the image, in pixels.
      - `height` number

        Height of the image, in pixels.
      - `alt` string

        Alt text of the image.
    - `options` object[]

      Option values of the line item's variant.

      *   Array \[

      - `name` string

        Name of the product option, for example `Color`.
      - `value` string

        Value selected for this product option.
      *   \]
    - `wholesale_price` object[]

      Wholesale price tiers.

      *   Array \[

      - `min_quantity` number

        Minimum quantity required for this wholesale tier.
      - `price` string

        Unit price of this wholesale tier.
      *   \]
    - `parts_price` string
    - `product_tags` undefined[]

      Tags of the product.
    - `published` boolean

      Whether the resource is published.
    - `published_at` string

      Publication time, in ISO-8601 format.
    - `inventory_quantity` number

      Inventory quantity.
    - `inventory_policy` string

      Whether the product keeps selling when it is out of stock.
    - `inventory_tracking` boolean

      Whether inventory tracking is enabled.
    - `cost_price` string

      Cost price of the variant.
    - `vendor` string

      Vendor of the product.
    - `vendor_url` string

      URL of the product vendor.
    - `barcode` string

      Barcode of the variant.
    - `mixed_wholesale` boolean

      Whether mixed wholesale is supported.
    - `tax_code` string
    - `retail_price` string

      Retail price in the store's main currency unit.
    - `item_text` string
    - `disabled` boolean
    - `is_free_gift` boolean

      Whether the item is a free gift.
    - `custom_discounts` undefined[]
    *   \]
  - `ineffectives` undefined[]

    Line items in the cart that can no longer be purchased.
  - `discount_applications` undefined[]

    Discounts applied to this object.
  - `attributes` undefined[]
  - `total_discount` string

    Total amount saved by all discounts on the cart.
  - `discount_line_item_price` string

    Discounted total for the applied discounts.
  - `currency` string

    Currency of the cart, for example `USD`.
  - `original_line_price` string

    Original price of the line item before discounts.
  - `original_total_price` string

    Total price of the cart before any discounts.
  - `line_price` string

    Combined price of all units in this line item, before discounts.
  - `total_price` string

    Total price of the cart after discounts.
  - `note` string

    Note attached to the object.
  - `created_at` string

    Creation time, in ISO-8601 format.
  - `updated_at` string

    Last update time, in ISO-8601 format.
  - `item_count` number

    Number of items in the cart.
  - `total_weight` number

    Total weight of all items in the cart.
  - `invalid_msg` string
  - `identity_cart_id` string

    Identifier of the cart. Use it to link a cart to the order it becomes.
  - `user_id` string

```json
{
  "cart": {
    "line_items": [
      {
        "id": "684765446766863303_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684765446766863303",
        "product_id": "14a309ec-b966-4cf9-a9bb-33baa821fdbc",
        "variant_id": "fff360dd-6457-466a-98b3-16878bacef5b",
        "quantity": "2",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "sample-product",
        "product_handle": "sample-product",
        "product_url": "/products/sample-product",
        "variant_title": "01",
        "product_type": "default",
        "price": "1.00",
        "compare_at_price": "1.00",
        "origin_price": "1.00",
        "line_price": "2.00",
        "original_line_price": 2,
        "saved_price": 0,
        "final_line_price": "2.00",
        "final_price": "1.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 999999999,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "",
        "spu": "",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "path": "free/e6e8dc980211cbef103e16371d6e0e61.jpeg",
          "width": 3000,
          "height": 1500,
          "alt": ""
        },
        "options": [
          {
            "name": "Size",
            "value": "01"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "1.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-08-10T07:28:24Z",
        "inventory_quantity": 0,
        "inventory_policy": "",
        "inventory_tracking": false,
        "cost_price": "1.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      },
      {
        "id": "684698318307074183_d41d8cd98f00b204e9800998ecf8427e",
        "item_id": "684698318307074183",
        "product_id": "b3b656ae-504f-4f01-a054-879a610925e3",
        "variant_id": "0699bc80-19ae-41bb-87c4-dbcbe5ed90a0",
        "quantity": "2",
        "note": "",
        "properties": "",
        "custom": false,
        "product_title": "Sample product",
        "product_handle": "Sample product",
        "product_url": "/products/Sample product",
        "variant_title": "Black-S",
        "product_type": "default",
        "price": "10.00",
        "compare_at_price": "20.00",
        "origin_price": "10.00",
        "line_price": "20.00",
        "original_line_price": 40,
        "saved_price": 10,
        "final_line_price": "20.00",
        "final_price": "10.00",
        "discount_applications": [],
        "fixed_discount_total": "0.00",
        "discount_total": "0.00",
        "discount_id": "",
        "available": true,
        "available_quantity": 48,
        "can_buy": true,
        "weight": "0.00",
        "weight_unit": "kg",
        "sku": "1111-BLACK-S-A001001",
        "spu": "1111",
        "requires_shipping": true,
        "taxable": false,
        "image": {
          "src": "//img.staticdj.com/50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "path": "50fa9b8c054f4d11b0d765de5f35dd4e.png",
          "width": 1254,
          "height": 1254,
          "alt": ""
        },
        "options": [
          {
            "name": "Color",
            "value": "Black"
          },
          {
            "name": "Size",
            "value": "S"
          }
        ],
        "wholesale_price": [
          {
            "min_quantity": 1,
            "price": "10.00"
          }
        ],
        "parts_price": "0.00",
        "product_tags": [],
        "published": true,
        "published_at": "2026-07-30T02:28:23Z",
        "inventory_quantity": 48,
        "inventory_policy": "deny",
        "inventory_tracking": true,
        "cost_price": "10.00",
        "vendor": "",
        "vendor_url": "",
        "barcode": "",
        "mixed_wholesale": false,
        "tax_code": "",
        "retail_price": "0.00",
        "item_text": "",
        "disabled": false,
        "is_free_gift": false,
        "custom_discounts": []
      }
    ],
    "ineffectives": [],
    "discount_applications": [],
    "attributes": [],
    "total_discount": "0.00",
    "discount_line_item_price": "0.00",
    "currency": "USD",
    "original_line_price": "0.00",
    "original_total_price": "0.00",
    "line_price": "0.00",
    "total_price": "0.00",
    "note": "",
    "created_at": "2026-06-23T19:57:16Z",
    "updated_at": "2026-09-02T14:13:27Z",
    "item_count": 0,
    "total_weight": 0,
    "invalid_msg": "",
    "identity_cart_id": "879f8b8f-c3a0-483c-baf6-f5a55a7ff5b4",
    "user_id": ""
  }
}
```

## Save a note on the cart

```text
POST /{locale}/api/cart/note
```

Use the `POST /{locale}/api/cart/note` endpoint to save a note on the cart. The body is `application/x-www-form-urlencoded`, not JSON.

### Example request

**Example request**

```javascript
const body = new URLSearchParams({ note: 'Leave the parcel at the door' });

fetch(window.SHOPLAZZA.routes.root + '/api/cart/note', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded'
  },
  body: body
})
  .then((response) => response.json())
  .then((data) => {
    // do something...
  });
```

### Request parameters

- `note` string

  The note to save on the cart.

### Response

**Schema | Example**

- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.
- `data` string

  The response payload.

```json
{
  "state": "success",
  "message": "success",
  "errors": [],
  "data": null
}
```

## Get the number of items in the cart

```text
GET /{locale}/api/cart/count
```

Use the `GET /{locale}/api/cart/count` endpoint to get cart count.

### Example request

**Example request**

```javascript
fetch(window.SHOPLAZZA.routes.root + '/api/cart/count')
  .then((response) => response.json())
  .then((data) => {
    // do something...
  })
  .catch((error) => {
    console.error('Error: ', error);
  });
```

### Response

**Schema | Example**

- `state` string

  Request result flag; `success` or `0` means the request succeeded.
- `message` string

  Result message returned with the response.
- `errors` undefined[]

  List of errors returned when the request fails.
- `data` object

  The response payload.

  - `count` number

    Number of items in the cart.

```json
{
  "state": "success",
  "message": "success",
  "errors": [],
  "data": {
    "count": 2
  }
}
```
