# ListItem

> How a single cart line is rendered by the API: key, title, quantity, price and your own data.

- Source: `api/models/ListItem.php` <https://github.com/wagnerwagner/merx/blob/2.0.0-alpha.11/api/models/ListItem.php>

## Fields

Available in the ListItem model, can be fetched with the `select` parameter.

| Name | Return type |
| --- | --- |
| key | `string` |
| title | `null\|string` |
| type | `string` |
| thumb | `null\|array` |
| url | `null\|string` |
| price | `null\|Wagnerwagner\Merx\Price` |
| total | `null\|Wagnerwagner\Merx\Price` |
| quantity | `float` |
| page | `null\|Kirby\Cms\Page` |
| data | `null\|array` |

## Views

Available in the ListItem model, can be fetched with the `view` parameter.

| Name | Fields |
| --- | --- |
| compact | `key, title, type, price, total, quantity` |
| default | `key, title, type, thumb, url, price, total, quantity, data, page<url, template, uuid>` |

## Type

`Wagnerwagner\Merx\ListItem`

## Examples

The ListItem model of an example cart, in each of its views.

```json title="View: default"
{
    "data": {
        "size": "42"
    },
    "key": "products/nice-shoes",
    "page": {
        "template": "product",
        "url": "https://shop.test/products/nice-shoes",
        "uuid": "page://Yk4fR7tNq2Lm9VxC"
    },
    "price": {
        "price": "€89.90",
        "priceIncludingTax": true,
        "priceNet": "€75.55",
        "priceNetRaw": 75.5499999999999971578290569595992565155029296875,
        "priceRaw": 89.900000000000005684341886080801486968994140625,
        "tax": {
            "price": "€14.35",
            "priceRaw": 14.3499999999999996447286321199499070644378662109375,
            "rate": "19%",
            "rateRaw": 0.190000000000000002220446049250313080847263336181640625
        }
    },
    "quantity": 1,
    "thumb": null,
    "title": "Nice Shoes",
    "total": {
        "price": "€89.90",
        "priceIncludingTax": true,
        "priceNet": "€75.55",
        "priceNetRaw": 75.5499999999999971578290569595992565155029296875,
        "priceRaw": 89.900000000000005684341886080801486968994140625,
        "tax": {
            "price": "€14.35",
            "priceRaw": 14.3499999999999996447286321199499070644378662109375,
            "rate": "19%",
            "rateRaw": 0.190000000000000002220446049250313080847263336181640625
        }
    },
    "type": "product",
    "url": "https://shop.test/products/nice-shoes"
}
```

```json title="View: compact"
{
    "key": "products/nice-shoes",
    "price": {
        "price": "€89.90",
        "priceIncludingTax": true,
        "priceNet": "€75.55",
        "priceNetRaw": 75.5499999999999971578290569595992565155029296875,
        "priceRaw": 89.900000000000005684341886080801486968994140625,
        "tax": {
            "price": "€14.35",
            "priceRaw": 14.3499999999999996447286321199499070644378662109375,
            "rate": "19%",
            "rateRaw": 0.190000000000000002220446049250313080847263336181640625
        }
    },
    "quantity": 1,
    "title": "Nice Shoes",
    "total": {
        "price": "€89.90",
        "priceIncludingTax": true,
        "priceNet": "€75.55",
        "priceNetRaw": 75.5499999999999971578290569595992565155029296875,
        "priceRaw": 89.900000000000005684341886080801486968994140625,
        "tax": {
            "price": "€14.35",
            "priceRaw": 14.3499999999999996447286321199499070644378662109375,
            "rate": "19%",
            "rateRaw": 0.190000000000000002220446049250313080847263336181640625
        }
    },
    "type": "product"
}
```
