Documentation
Feedback
Guides
API Reference

Guides
CheckoutShopping CartSimulate a shopping cart
Simulate a shopping 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 the process of simulating a shopping cart at Checkout.

Simulating a shopping cart

The first step is to send the parameters you want to be in the cart. This can be done via the Cart Simulation endpoint's request body.

See a request body example below:


_10
{
_10
"items": [
_10
{
_10
"id": "1",
_10
"quantity": 1,
_10
"seller": "1"
_10
}
_10
],
_10
"country": "BRA"
_10
}

️ The fields id, quantity, seller, and country are just examples of content that you can simulate in your cart. You can add more fields to the request as per your need. Access the orderForm overview to check the available fields.

After sending the request, the endpoint will return the response body containing the shopping cart information, as shown in the example below:


_36
"items": [
_36
{
_36
"id": "1",
_36
"requestIndex": 0,
_36
"quantity": 1,
_36
"seller": "1",
_36
"sellerChain": [
_36
"1"
_36
],
_36
"tax": 0,
_36
"priceValidUntil": "2023-09-28T11:53:03Z",
_36
"price": 9999,
_36
"listPrice": 13499,
_36
"rewardValue": 0,
_36
"sellingPrice": 2999700,
_36
"offerings": [],
_36
"priceTags": [],
_36
"measurementUnit": "un",
_36
"unitMultiplier": 300.0000,
_36
"parentItemIndex": null,
_36
"parentAssemblyBinding": null,
_36
"availability": "available",
_36
"catalogProvider": "vrn:vtex.catalog-api-proxy:-:lojadobreno:master:/proxy/authenticated/catalog/pvt/sku/stockkeepingunitbyid/1",
_36
"priceDefinition": {
_36
"calculatedSellingPrice": 2999700,
_36
"total": 2999700,
_36
"sellingPrices": [
_36
{
_36
"value": 2999700,
_36
"quantity": 1
_36
}
_36
]
_36
}
_36
}
_36
],
_36
...

Error codes

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

200 - OK

Despite the code 200 (which indicates the success of the request), if the item id sent is incorrect or unavailable, the following message will appear.

  • Message error example (code ORD027): "Item 5550 não encontrado ou indisponível" (item 5550 not found or unavailable).

_10
"messages": [
_10
{
_10
"code": "ORD027",
_10
"text": "Item 5550 não encontrado ou indisponível",
_10
"status": "error",
_10
"fields": {
_10
"id": "5550"
_10
}
_10
}
_10
]

400 - Bad Request

The Bad Request error appears for several reasons, such as when a mandatory field was not filled in correctly (eg seller) or the item quantity was not specified. In addition to the 400 error code, an additional code will be shown to indicate the type of error.

  • Message error example (code ORD005): "O campo Id do item é obrigatório" (item ID field is required).

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "ORD005",
_10
"message": "O campo Id do item é obrigatório",
_10
"exception": null
_10
},
_10
"operationId": "5ac2e42e-0967-43b3-b0b4-dcbc6da118b1"
_10
}

  • Message error example (code CHK0024): "Id de vendedor de item inválido" (invalid item seller id).

_10
{
_10
"fields": {},
_10
"error": {
_10
"code": "CHK0024",
_10
"message": "Id de vendedor de item inválido",
_10
"exception": null
_10
},
_10
"operationId": "7adbc4af-32c8-4365-9f7e-c40ffc9ccf5a"
_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