Documentation
Feedback
Guides
API Reference

Guides
CheckoutShopping CartRemove all items from cart
Remove all items from cart

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 remove all items from a shopping cart by the API.

Getting and accessing shopping cart information

The first step is to get the orderFormId and access the shopping cart information that you want to remove the items from. To do so, access the Get cart information by ID guide.

See below an example of item details contained in a shopping cart:


_77
...
_77
"items": [
_77
{
_77
"uniqueId": "C6D260865A4B4609B494973D96790104",
_77
"id": "5",
_77
"productId": "7",
_77
"productRefId": "",
_77
"refId": null,
_77
"ean": "978020137962",
_77
"name": "Ultra Moisturizing Milk Conditioner 100 ml",
_77
"skuName": "100 ml",
_77
"modalType": null,
_77
"parentItemIndex": null,
_77
"parentAssemblyBinding": null,
_77
"assemblies": [],
_77
"priceValidUntil": "2023-10-11T16:31:28Z",
_77
"tax": 0,
_77
"taxCode": "54WC8ZN6K8" ,
_77
"price": 4490,
_77
"listPrice": 4490,
_77
"manualPrice": null,
_77
"manualPriceAppliedBy": null,
_77
"sellingPrice": 448509,
_77
"rewardValue": 0,
_77
"isGift": false,
_77
"additionalInfo": {
_77
"dimension": null,
_77
"brandName": "VALDIE&CO",
_77
"brandId": "2000000",
_77
"offeringInfo": null,
_77
"offeringType": null,
_77
"offeringTypeId": null
_77
},
_77
"preSaleDate": null,
_77
"productCategoryIds": "/4/1/",
_77
"productCategories": {
_77
"1": "Treatments",
_77
"4": "Stylers"
_77
},
_77
"quantity": 1,
_77
"seller": "cosmetics1",
_77
"sellerChain": [
_77
"cosmetics1"
_77
],
_77
"imageUrl": "http://cosmetics2.vteximg.com.br/arquivos/ids/155403-55-55/Ultra-Moisturizing-Milk-Conditioner.jpg?v=637109315995300000",
_77
"detailUrl": "/ultra-moisturizing-milk-conditioner/p",
_77
"components": [],
_77
"bundleItems": [],
_77
"attachments": [],
_77
"attachmentOfferings": [],
_77
"offerings": [],
_77
"priceTags": [
_77
{
_77
"name": "discount@price-0e45a4e3-6084-4bf9-bff7-0fe8403699fc#5aeb71dd-f6dd-4a2d-a624-d635f20e7cd0",
_77
"value": -491,
_77
"rawValue": -4.91,
_77
"isPercentual": false,
_77
"identifier": "0e45a4e3-6084-4bf9-bff7-0fe8403699fc",
_77
"owner": "cosmetics2"
_77
}
_77
],
_77
"availability": "available",
_77
"measurementUnit": "mg",
_77
"unitMultiplier": 100.0000,
_77
"manufacturerCode": null,
_77
"priceDefinition": {
_77
"calculatedSellingPrice": 448509,
_77
"total": 448509,
_77
"sellingPrices": [
_77
{
_77
"value": 448509,
_77
"quantity": 1
_77
}
_77
]
_77
}
_77
},
_77
...

️ For more information about the meaning of each of the fields available in the shopping cart, access the orderForm overview.

Removing all items from the shopping cart

To remove all items from the shopping cart, you need to use the Remove all items endpoint. In this request, the ordeFormId of the shopping cart must be sent through the URL request, as shown by the example below:

https://{accountname}.{environment.com.br}/api/checkout/pub/orderForm/{orderFormId}/items/removeAll

Additionally, you need to send the request body containing only two curly brackets, as shown below:


_10
{}

After sending the request, the endpoint will return the response body with all item information removed from the shopping cart ("items" field empty).


_10
...
_10
"items": [],
_10
...

Error codes

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

400 - Bad Request

  • Message error example (code ORD002): "Carrinho inválido" (Invalid Cart): this message indicates that the orderFormId used in the request does not exist or is incorrect.

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "ORD002",
_10
"message": "Carrinho inválido",
_10
"exception": null
_10
},
_10
"operationId": "5d37a185-bfe6-4686-9d92-aac9482cc63d"
_10
}

  • Message error example (code 001): "Bad Request": this message indicates that information other than {} was sent in the request body.

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "001",
_10
"message": "Bad request",
_10
"exception": null
_10
},
_10
"operationId": "91b68251-1a60-4716-b846-c7c9c31fa565"
_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
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest Edits (GitHub)
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page