#  CartItem

Each item in the [Cart](../cart/readme.md) is a `CartItem`.
<br>
A CartItem could represent a product variation or a package.

## Usage

```JavaScript
cartApi.add('apple', 3)
    .then(() => {
        var cartItem = cart.items[0];
        console.log(`There are ${cartItem.quantity} apples in the cart.`);
    });
```

## Properties

| Name                    | Type                          | Description                                   |
|-------------------------|-------------------------------|-----------------------------------------------|
| id                      | String                        | A unique identifier                           |
| name                    | String                        | The name of the product variation or package  |
| quantity                | Number                        | The total quantity of all items               |
| quantityInStock         | Number                        | |
| currency                | String                        | Example: `SEK`                                |
| imageUrl                | [Image](../image/readme.md)   | |
| url                     | String                        | A url to a product page                       |
| discountPrice           | [Price](../price/readme.md)   | |
| discountPriceWithoutTax | [Price](../price/readme.md)   | |
| listPrice               | [Price](../price/readme.md)   | The catalog price                             |
| listPriceWithoutTax     | [Price](../price/readme.md)   | |
| totalPrice              | [Price](../price/readme.md)   | |
| totalPriceWithoutTax    | [Price](../price/readme.md)   | |
| totalDiscount           | [Price](../price/readme.md)   | |
| meta                    | Object                        | An object that contains project-specific data.<br>For example, `{color: 'green'}` |


## Tests

[Run unit tests](../../test/index.html?grep=CartItem)