> For the complete documentation index, see [llms.txt](https://zrpl-co-1.gitbook.io/zrpl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zrpl-co-1.gitbook.io/zrpl/reference/api-reference/update-cart.md).

# Update Cart

This API is offering to Update Cart.

<mark style="color:green;">`PUT`</mark> `{{Base_url}}/rest/V1/carts/mine/items/97340`

This cURL command is used to update the quantity of a specific item (with `item_id: 97340`) in the **customer's shopping cart** in a Magento application.

**Body**

{% tabs %}
{% tab title="Request Body" %}

```json
{
    "cartItem": {
        "qty": 5,
        "quote_id": "615984"
    }
}
```

{% endtab %}
{% endtabs %}

#### **Attributes Explanation**

1. **`cartItem`**:
   * This is the main key that contains the details of the cart item you want to update.
   * It holds the subfields `qty` and `quote_id`.
2. **`qty`**:
   * This specifies the **new quantity** for the item in the cart.
   * **Value**: `5` (indicates you want 5 units of this product in the cart).
3. **`quote_id`**:
   * This is the **unique ID of the cart** (also referred to as the "Quote ID").
   * It ensures that the update is applied to the correct cart for the current session or customer.
   * **Value**: `"615984"`

{% tabs %}
{% tab title="Curl" %}

```json
curl --location --request PUT '{{Base_url}}/rest/V1/carts/mine/items/97340' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer eyJraWQiOiIxIiwiYWxnIjoiSFMyNTYifQ.eyJ1aWQiOjIxMDAyNywidXR5cGlkIjozLCJpYXQiOjE3Mzc2MTc4MTAsImV4cCI6MTczNzYyMTQxMH0.0ah6EAAskmEp0Q_cg9rKUem_oRr66YLYbtGBQWGsngE' \
--header 'Cookie: PHPSESSID=2639naaq26nbe7st472kk4ms4i' \
--data '{
    "cartItem": {
        "qty": 5,
        "quote_id": "615984"
    }
}

```

{% endtab %}
{% endtabs %}

**Responses**

{% tabs %}
{% tab title="Success Response" %}

```json
{
    "item_id": 97340,
    "sku": "IFPZMB-NP0",
    "qty": 5,
    "name": "iFrogz Audio- Ear Pollution Plugz with Mic - Neon Pink",
    "price": 399,
    "product_type": "simple",
    "quote_id": "615984"
}
```

{% endtab %}
{% endtabs %}

#### **Explanation**

* **`item_id`**:
  * **Value**: `97340`
  * **Explanation**: The unique identifier for the specific item in the cart. It distinguishes this cart item from others in the same cart.
* **`sku`**:
  * **Value**: `"IFPZMB-NP0"`
  * **Explanation**: The **Stock Keeping Unit (SKU)** of the product. It is a unique code used to identify the product in the catalog.
* **`qty`**:
  * **Value**: `5`
  * **Explanation**: The **quantity** of this product added to the cart. In this case, it indicates 5 units of the product are in the cart.
* **`name`**:
  * **Value**: `"iFrogz Audio- Ear Pollution Plugz with Mic - Neon Pink"`
  * **Explanation**: The **name** or title of the product as it appears in the catalog.
* **`price`**:
  * **Value**: `399`
  * **Explanation**: The **price** of a single unit of the product, expressed in the store’s base currency. This does not include any discounts, taxes, or shipping charges.
* **`product_type`**:
  * **Value**: `"simple"`
  * **Explanation**: The **type of product** in Magento. Common types include:
    * `simple`: A standalone product without variations.
    * `configurable`: A product with multiple variations (e.g., color, size).
* **`quote_id`**:
  * **Value**: `"615984"`
  * **Explanation**: The unique **ID of the cart** (also known as the quote ID). This links the item to the customer’s active cart and ensures the update is applied to the correct session.

{% tabs %}
{% tab title="Invalid Cart 404" %}

```javascript
{
    "message": "Current customer does not have an active cart."
}
```

{% endtab %}

{% tab title="Invalid Token 401 " %}

```python
{
    "message": "The consumer isn't authorized to access %resources.",
    "parameters": {
        "resources": "self"
    }
}
```

{% endtab %}
{% endtabs %}
