Documentation
Feedback
Guides
API Reference

Guides
CheckoutShopping CartUpdate cart items
Update cart items

The shopping cart is where the information on the products chosen by the customer while browsing a store is gathered. This data may include item prices, shipping value, payment, and delivery methods, among others.

This guide will describe how to modify the quantity of an item in the cart or remove it by the API.

️ To remove all items from the cart at the same time, use the Remove all items endpoint.

Getting shopping cart information

The first step is to get the orderFormId of the shopping cart that you want to update cart items information. For more information, access the Get cart information by ID guide.

Updating shopping cart items quantity

To update items in the shopping cart, you need to use the Update cart items endpoint. In this request, you must send the following information through the URL:

  • Path param: orderFormId value.
  • Query param: allowedOutdatedData. You can set up this query as false or true to define whether some cart information can be updated through the minicart.

See a URL example below:

https://accountname.environment.com.br/api/checkout/pub/orderForm/ede846222cd44046ba6c638442c3505a/items?allowedOutdatedData=paymentData

Additionally, you need to send the request body containing the index (item's position in the array or cart) and the new quantity value. See a request body example below:


_10
{
_10
"orderItems": [
_10
{
_10
"quantity": 3,
_10
"index": "1"
_10
}
_10
]
_10
}

After sending the request, the endpoint will return the response body with the shopping cart information containing the new item quantity information.


_76
...
_76
"items": [
_76
{
_76
"uniqueId": "BAE0177A615A4EB1B261DDF3274076F8",
_76
"id": "5",
_76
"productId": "7",
_76
"productRefId": "",
_76
"refId": null,
_76
"ean": "978020137962",
_76
"name": "Ultra Moisturizing Milk Conditioner 100 ml",
_76
"skuName": "100 ml",
_76
"modalType": null,
_76
"parentItemIndex": null,
_76
"parentAssemblyBinding": null,
_76
"assemblies": [],
_76
"priceValidUntil": "2023-11-08T18:01:42Z",
_76
"tax": 0,
_76
"price": 4490,
_76
"listPrice": 4490,
_76
"manualPrice": null,
_76
"manualPriceAppliedBy": null,
_76
"sellingPrice": 448840,
_76
"rewardValue": 0,
_76
"isGift": false,
_76
"additionalInfo": {
_76
"dimension": null,
_76
"brandName": "VALDIE&CO",
_76
"brandId": "2000000",
_76
"offeringInfo": null,
_76
"offeringType": null,
_76
"offeringTypeId": null
_76
},
_76
"preSaleDate": null,
_76
"productCategoryIds": "/4/1/",
_76
"productCategories": {
_76
"1": "Treatments",
_76
"4": "Stylers"
_76
},
_76
"quantity": 3,
_76
"seller": "cosmetics1",
_76
"sellerChain": [
_76
"cosmetics1"
_76
],
_76
"imageUrl": "http://cosmetics2.vteximg.com.br/arquivos/ids/155403-55-55/Ultra-Moisturizing-Milk-Conditioner.jpg?v=637109315995300000",
_76
"detailUrl": "/ultra-moisturizing-milk-conditioner/p",
_76
"components": [],
_76
"bundleItems": [],
_76
"attachments": [],
_76
"attachmentOfferings": [],
_76
"offerings": [],
_76
"priceTags": [
_76
{
_76
"name": "discount@price-0e45a4e3-6084-4bf9-bff7-0fe8403699fc#e5b461db-58da-46a0-87b9-fbab27c5caad",
_76
"value": -480,
_76
"rawValue": -4.8,
_76
"isPercentual": false,
_76
"identifier": "0e45a4e3-6084-4bf9-bff7-0fe8403699fc",
_76
"owner": "cosmetics2"
_76
}
_76
],
_76
"availability": "cannotBeDelivered",
_76
"measurementUnit": "mg",
_76
"unitMultiplier": 100.0000,
_76
"manufacturerCode": null,
_76
"priceDefinition": {
_76
"calculatedSellingPrice": 448840,
_76
"total": 1346520,
_76
"sellingPrices": [
_76
{
_76
"value": 448840,
_76
"quantity": 3
_76
}
_76
]
_76
}
_76
},
_76
...

️ For more information about the meaning of each of the fields available in the shopping cart, access the orderForm overview." } [/block]

Removing shopping cart items

To remove an item from the cart you must use the same endpoint and parameters as in the previous section (Updating shopping cart items quantity). However, the quantity value to be sent in the request body must be 0. See a request body example below:


_10
...
_10
{
_10
"orderItems": [
_10
{
_10
"quantity": 0,
_10
"index": 1
_10
}
_10
]
_10
}
_10
...

After sending the request, the endpoint will return the response body with the shopping cart information without the removed item.

Error codes

The following errors may appear as a message in the response body.

400 - Bad Request

  • Message error example (code ORD002): "Invalid order form". The orderFormId information is not valid.

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "ORD002",
_10
"message": "Invalid order form",
_10
"exception": null
_10
},
_10
"operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98"
_10
}

  • Message error example (code CHK0023): "Invalid quantity for the item". This message indicates that the quantity value (mandatory) has not been sent in the request body.

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "CHK0023",
_10
"message": "Invalid quantity for item",
_10
"exception": null
_10
},
_10
"operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98"
_10
}

  • Message error example (code CHK0041): "Invalid item index". This message indicates that the index used in the request does not exist or is incorrect.

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "CHK0041",
_10
"message": "Invalid item index",
_10
"exception": null
_10
},
_10
"operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98"
_10
}

404 - Not Found

  • Message error example: "The requested URL was not found on the server". Check that the URL data is correct.

_10
<body>
_10
<h1>404 Not Found</h1>
_10
<p>The requested URL was not found on this server.</p>
_10
</body>

Contributors
1
Photo of the contributor
+ 1 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
1
Photo of the contributor
+ 1 contributors
On this page