> For the complete documentation index, see [llms.txt](https://docs.violet.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.violet.io/prism/checkout-guides/carts-and-bags/carts/modify-items-in-cart.md).

# Modify Items in Cart

Items in a cart can be modified in two ways:

1. Update SKU Quantity
2. Delete SKU from Cart

{% hint style="info" %}
When adding SKUs to a cart, we actually create optimized models called `OrderSKU`s. When making modifications to an item in a cart, you are actually interacting with the `OrderSKU`, which has a different `Id` to the original `SKU`; you can find the original `Id` listed as `sku_id`.
{% endhint %}

## Update SKU Quantity

Once an item is added to a cart, you may want to let the shopper increase or decrease the quantity of the SKU in the cart.

{% hint style="info" %}
If you update the quantity of the cart, you will want to make sure to get the most recent price for the cart with the new quantity. If doing this after shipping methods have been selected, you may want to return to this step.
{% endhint %}

Let’s start with a Cart shown below:

```json
{
    "id": 76448,
    "token": "f4fc7b7afc504898b532d2e6668e3504",
    "user_id": 10397,
    "app_id": 10382,
    "developer_id": 10292,
    "bags": [
        {
            "id": 62158,
            "order_id": 76448,
            "merchant_id": 10189,
            "app_id": 10382,
            "status": "IN_PROGRESS",
            "fulfillment_status": "PROCESSING",
            "financial_status": "UNPAID",
            "skus": [
                {
                    "id": 81227,
                    "merchant_id": 10189,
                    "app_id": 10382,
                    "product_id": "87f88388d8a44de6b7ea74d1b822926f",
                    "sku_id": 196585,
                    "external_id": "45101059440941",
                    "name": "Pastel Flower Land - Extra-Large / Design Three / Blue",
                    "brand": "The Violet Garden",
                    "thumbnail": "https://cdn.shopify.com/s/files/1/0758/9363/7421/files/wealthy_floral_design_tshirt_with_a_blue_pastel_colour_backgrou_caefa8e2-b19a-4eb7-84a1-1855591d017b.png",
                    "quantity": 1,
                    "price": 3500,
                    "weight": 3.0,
                    "available": true,
                    "status": "IN_PROGRESS",
                    "product_type": "PHYSICAL",
                    "line_price": 3500
                }
            ],
            "taxes": [],
            "sub_total": 3500,
            "taxes_included": false,
            "transactions": [],
            "external_checkout": true,
            "commission_rate": 25.0,
            "date_created": "2023-10-01T02:37:47+0000",
            "remorse_period_ends": "2023-10-31T02:37:47+0000",
            "currency": "USD",
            "external_currency": "USD",
            "channel": "APP",
            "platform": "SHOPIFY",
            "fulfillments": [],
            "discounts": [],
            "wallet_based_checkout": false,
            "bag_status": "IN_PROGRESS",
            "bag_id": 62158,
            "merchant_name": "the violet garden"
        }
    ],
    "sub_total": 3500,
    "status": "IN_PROGRESS",
    "is_guest": true,
    "date_created": "2023-10-01T02:37:46+0000",
    "date_last_modified": "2023-10-01T02:37:46+0000",
    "priced": false,
    "wallet_based_checkout": false,
    "currency": "USD",
    "errors": [],
    "channel": "APP",
    "currency_symbol": "$",
    "stripe_key": "pk_test_UHg8oLvg4rrDCbvtqfwTE8qd",
    "guest": true,
    "order_status": "IN_PROGRESS",
    "order_id": 76448,
    "intent_based_checkout": false
}
```

You can update the quantity of a SKU in the cart using the [Update SKU in Cart](/api-reference/orders-and-checkout/cart-items/update-sku-in-cart.md) endpoint.

```bash
curl --location --request PUT 'https://sandbox-api.violet.io/v1/checkout/cart/76448/skus/81227' \
    --header 'Content-Type: application/json' \
    --header 'X-Violet-Token: <TOKEN>' \
    --header 'X-Violet-App-Secret: <SECRET>' \
    --header 'X-Violet-App-Id: <APP_ID>' \
    --data-raw '{
        "quantity": 10
}'
```

The response will be a standard `Cart` response with the updated SKU values reflected in their respective `Bags`.

## Delete SKU from Cart

{% hint style="info" %}
After deleting a sku from the cart you will need to re-price the cart. If you had previously selected a shipping method, that shipping method will be removed and you will need get new ones.
{% endhint %}

If you want to delete the SKU from the Cart altogether, you can use the [Delete SKU from Cart](/api-reference/orders-and-checkout/cart-items/remove-sku-from-cart.md) API. This will delete the item in the cart that matches the `order_sku_id` that you pass in.

```bash
curl --request DELETE \
    --url https://sandbox-api.violet.io/v1/checkout/cart/{cart_id}/skus/{order_sku_id}
    --header 'Content-Type: application/json' \
    --header 'X-Violet-Token: <TOKEN>' \
    --header 'X-Violet-App-Secret: <SECRET>' \
    --header 'X-Violet-App-Id: <APP_ID>' \
```

The response will be a standard `Cart` response with the updated SKU values reflected in their respective `Bags`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.violet.io/prism/checkout-guides/carts-and-bags/carts/modify-items-in-cart.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
