# Views for Cart modifying operations

Endpoints that modify a Cart ( e.g. [Cart / Order Line Items](/readme/headless/reference/cart-order-line-items.md#add-line-item-to-a-cart)) can return one of the available views representing the updated Cart. By using views, you will not need to fetch the updated Cart in a subsequent API call.

The views can be requested by adding a `views` query parameter to your request with at least one of the following views:

## Views

<table><thead><tr><th width="192">View</th><th>Description</th></tr></thead><tbody><tr><td>miniCart</td><td>Returns a subset of Cart data.</td></tr></tbody></table>

## Examples

### Request

```bash
curl -D- -X POST <base_url>/api/v1/carts/<cartId>/lines?views=miniCart \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
        ...<the parameters for the request>...
    }'
```

### MiniCart Response

```json
{
    "miniCart": {
        "customProperties": [
            {
                "id": "{id}",
                "key": "{propKey}",
                "value": "{propValue}"
            }
        ],
        "createdDate": "{createdDate}",
        "cultureCode": "{cultureCode}",
        "discount": "{discountAmount}",
        "discountTotal": "{discountTotalAmount}",
        "id": "{id}",
        "note": "{note}",
        "orderLines": [
            {
                "discount": "{discountAmount}",
                "discounts": "{[discount1Amount, discount2Amount]}",
                "id": "{id}",
                "price": "{priceAmount}",
                "priceGroupId": "{priceGroupId}",
                "productCatalogId": "{productCatalogId}",
                "productName": "{productName}",
                "quantity": "{quantityNumber}",
                "sku": "{sku}",
                "total": "{totalAmount}",
                "unitDiscount": "{unitDiscountAmount}",
                "variantSku": "{variantSku}",
                "tax": "{taxAmount}",
                "taxRate": "{taxRateAmount}",
                "customProperties": [
                    {
                        "id": "{id}",
                        "key": "{propKey}",
                        "value": "{propValue}"
                    }
                ]
            }
        ],
        "orderTotal": "{orderTotalAmount}",
        "paymentTotal": "{paymentTotalAmount}",
        "shippingTotal": "{shippingTotalAmount}",
        "subTotal": "{subTotalAmount}",
        "tax": "{taxAmount}"
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.ucommerce.net/readme/headless/reference/views-for-cart-modifying-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
