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 get the information of your current shopping cart (orderFormId
) or to create a new cart with the API.
Accessing current shopping cart information
To access your current shopping cart information, you must use the Get current or create a new cart endpoint. In this request, it is not required to send any additional information (path params, query, or body). See this URL example:
https://{accountName}.{environment}.com.br/api/checkout/pub/orderForm
After sending the request, the endpoint will return the response body containing the information of your current shopping cart, as shown in the example below:
_92{_92 "orderFormId": "11c257869e444e7185e61cab475f91bd",_92 "salesChannel": "1",_92 "loggedIn": false,_92 "isCheckedIn": false,_92 "storeId": null,_92 "checkedInPickupPointId": null,_92 "allowManualPrice": false,_92 "canEditData": true,_92 "userProfileId": null,_92 "userType": null,_92 "ignoreProfileData": false,_92 "value": 0,_92 "messages": [],_92 "items": [_92 {_92 "uniqueId": "D1E0949706A3441DA0386929FAB6E7E8",_92 "id": "2005",_92 "productId": "3",_92 "productRefId": "",_92 "refId": null,_92 "ean": "978020137962",_92 "name": "Weightless Waves Mild Lather Cleanser 50 ml",_92 "skuName": "50 ml",_92 "modalType": null,_92 "parentItemIndex": null,_92 "parentAssemblyBinding": null,_92 "assemblies": [],_92 "priceValidUntil": "2023-11-07T22:14:44Z",_92 "tax": 0,_92 "price": 3190,_92 "listPrice": 3190,_92 "manualPrice": null,_92 "manualPriceAppliedBy": null,_92 "sellingPrice": 3107,_92 "rewardValue": 0,_92 "isGift": false,_92 "additionalInfo": {_92 "dimension": null,_92 "brandName": "VALDIE&CO",_92 "brandId": "2000000",_92 "offeringInfo": null,_92 "offeringType": null,_92 "offeringTypeId": null_92 },_92 "preSaleDate": null,_92 "productCategoryIds": "/2/",_92 "productCategories": {_92 "2": "Computers"_92 },_92 "quantity": 3,_92 "seller": "cosmetics1",_92 "sellerChain": [_92 "cosmetics1"_92 ],_92 "imageUrl": "http://cosmetics2.vteximg.com.br/arquivos/ids/155401-55-55/ID-001-MAIN.jpg?v=637109313796670000",_92 "detailUrl": "/weightless-waves-mild-lather-cleanser/p",_92 "components": [],_92 "bundleItems": [],_92 "attachments": [],_92 "attachmentOfferings": [],_92 "offerings": [],_92 "priceTags": [_92 {_92 "name": "discount@price-0e45a4e3-6084-4bf9-bff7-0fe8403699fc#ac2d3d37-5845-45a6-9254-191449d6f100",_92 "value": -416,_92 "rawValue": -4.160,_92 "isPercentual": false,_92 "identifier": "0e45a4e3-6084-4bf9-bff7-0fe8403699fc",_92 "owner": "cosmetics2"_92 }_92 ],_92 "availability": "available",_92 "measurementUnit": "un",_92 "unitMultiplier": 1.0000,_92 "manufacturerCode": null,_92 "priceDefinition": {_92 "calculatedSellingPrice": 3107,_92 "total": 15534,_92 "sellingPrices": [_92 {_92 "value": 3107,_92 "quantity": 4_92 },_92 {_92 "value": 3106,_92 "quantity": 1_92 }_92 ]_92 }_92 },_92...
️ If you want access to a specific shopping cart (other than your current one) and you already know its
orderFormId
, you can find it through the Get cart information by ID endpoint. See more information at Get cart information by ID guide.
Creating the new shopping cart
To create a new shopping cart, in the same way that to obtain the information of the current cart, you must use the Get current or create a new cart endpoint. However, in this request, you must also send the query parameter forceNewCart = true
, as shown in this URL example:
https://{accountName}.{environment}.com.br/api/checkout/pub/orderForm?forceNewCart=true
After sending the request, the endpoint will return the response body containing the information about the new shopping cart created, as shown in the example below:
_36{_36 "orderFormId": "ede846222cd44046ba6c638442c3505a",_36 "salesChannel": "1",_36 "loggedIn": false,_36 "isCheckedIn": false,_36 "storeId": null,_36 "checkedInPickupPointId": null,_36 "allowManualPrice": false,_36 "canEditData": true,_36 "userProfileId": null,_36 "userType": null,_36 "ignoreProfileData": false,_36 "value": 0,_36 "messages": [],_36 "items": [],_36 "selectableGifts": [],_36 "totalizers": [],_36 "shippingData": null,_36 "clientProfileData": {_36 "email": null,_36 "firstName": null,_36 "lastName": null,_36 "document": null,_36 "documentType": null,_36 "phone": null,_36 "corporateName": null,_36 "tradeName": null,_36 "corporateDocument": null,_36 "stateInscription": null,_36 "corporatePhone": null,_36 "isCorporate": false,_36 "profileCompleteOnLoading": null,_36 "profileErrorOnLoading": null,_36 "customerClass": null_36 },_36...
️ For more information about the meaning of each of the fields available in the shopping cart, access the orderForm overview.
Error codes
The following error may appear as a message in the response body.
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>