---
schema_version: "1"
id: 17c402960e998888a1be8a2fd13fbe29d285bc57f76af1d02ecf1ccb0b08de6d
title: Multi Edit Cart Line Items
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/industries/cme/guides/standard_cart/std_comms-multi-edit.md
canonical_url: https://developer.salesforce.com/docs/industries/cme/guide/std_comms-multi-edit.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 0277cca6b9e581f63f91405f618d5882f02a6bb86de079715b349ae8f9a42f72
products:
  - Communications, Media, Energy and Utilities APIs (Managed Package)
  - Industries Developer Documentation
---
# Multi Edit Cart Line Items

Multi Edit Cart Line Items API allows the user to update multiple items present in the cart in a single transaction. It could be to update all modified attributes and fields at once across line items.

**note:** This API follows an all or nothing approach such that either the changes made to all line items are applied to the cart or none are applied at all.

## URI

```nolang
/services/apexrest/{namespace}/v2/cpq/carts/{cart_ID}/items
```

## HTTP Method

PATCH

## Apex Method

`multiEditCartItems`

## Apex Remote Service

```nolang
CpqAppHandler
```


## Request Parameters

| Parameter   | Description                                                                    |
| ----------- | ------------------------------------------------------------------------------ |
| `namespace` | `vlocity_cmt`                                                                  |
| `cart_ID`   | The unique ID of the cart, which is the ID of the opportunity, quote, or order |

## Query Parameters

| Parameter  | Description                                                         |
| ---------- | ------------------------------------------------------------------- |
| `price`    | Execute the pricing service and price the affected items.           |
| `validate` | Execute the context rules and advance rules for the affected items. |

## Example Request

```nolang
PATCH
/services/apexrest/vlocity_cmt/v2/cpq/carts/{cartid}/items?price=true&validate=true

Request Body:
{
  "items": [
    {
      "rootItemId": "f6e846b1-2a7e-4d8a-8de5-50e5f986ca4e",
      "assetReferenceId": "c548e1d2-8078-4eca-8a79-916ba79b2595",
      "fields": {
        "<field_api_name1>": "value1",
        "<field_api_name2>": "value2",
        "quantity": "value3",
        ...
      },
      "attributes": {
        "<attributeCode>" : "userValue",
        "<attribute2Code>" : ["userValue2", "userValue3"],
        ...
      }
    }
  ]
}

```

## Example putCartsItems Request

In order to update quantity for the multiple line item, it requires to update the Quantity fields under corresponding rootItemId and assetReferenceId for the line item as per above JSON format, and send a PATCH request for update.

```nolang
{
   "items": [
      {
        "rootItemId": "f6e846b1-2a7e-4d8a-8de5-50e5f986ca4e",
        "assetReferenceId": "f6e846b1-2a7e-4d8a-8de5-50e5f986ca4e",
        "fields": {
           "Quantity": 5
      }
    },
 {
        "rootItemId": "f6e846b1-2a7e-4d8a-8de5-50e5f986ca4e",
        "assetReferenceId": "c548e1d2-8078-4eca-8a79-916ba79b2595",
        "fields": {
           "Quantity": 7
      }
    }
  ]
}
```

## Example Response

The API does not provide a complete response after each modification. It’s just success or failure. In order to fetch the updated cart info, customers are required to execute the getCartItems API further.

**Success Scenario**

```nolang
{
    "status":"success",
    "message":"Line Items are updated successfully.",
    "code":"200.MultiEditCartItems.000"
}
```

**Failure Scenario**

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.002",
  "message" : "Invalid cartId passed in request URL."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.011",
  "message" : "Set CPQ Configuration UseAssetReferenceIdForParentAndRoot to true for MultiEditCartItem API to work."
}
```

```nolang
{
  "status" : "error",
  "code" : "413.MultiEditCartItems.001",
  "message" : "Guardrail Exception : Limit for MultiEditCartItem API is : 20 per API call."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.010",
  "message" : "Invalid Asset Ref Ids: [Id] passed in Input."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.006",
  "message" : "Disconnected line item cannot be edited."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.015",
  "message" : "No Fields or Attributes to Edit for Asser Reference Ids : [ID]."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.014",
  "message" : "Duplicate Line Items for assetRefIds : [ID]."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.001",
  "message" : "Field passed [FieldName] is invalid."
}
```

```nolang
{
  "status" : "error",
  "code" : "400.MultiEditCartItems.002",
  "message" : "Field passed [FieldName] is not editable."
}
```
