Get cart information by ID

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 access information for a specific shopping cart by its identification code (orderFormId).

Getting shopping cart ID

The first step is to get the orderFormId of the shopping cart you want to check. You can obtain this information in the following ways:

  1. Creating a new cart using the Create a new cart endpoint. The response body of this request will give you the orderFormId for an empty cart. See more information at Create a new cart Guide.
  2. Accessing the website where a shopping cart is open (the order has not already been concluded), and following these steps:
    a. Go to the Dev. Tools screen (press the F12 key).
    b. Click the Application tab, and under Cookies, click the name of the site's URL.
    c. In the table, locate the line checkout.vtex.com and record the value _ofid=. This is the orderFormId of the current shopping cart.
833833

Accessing shopping cart information

With the orderFormId information available, you must use the Get cart information by ID endpoint to send the following information through the URL:

  • Path param: orderFormId value.
  • Query param: refreshOutdatedData. You can set up this query as false or true to define whether some cart information can be updated by the Update cart items endpoint.

See an URL example below:

https://{accountname}.{environment.com.br}/api/checkout/pub/orderForm/ede846222cd44046ba6c638442c3505a?refreshOutdatedData=true

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

{
    "orderFormId": "ede846222cd44046ba6c638442c3505a",
    "salesChannel": "1",
    "loggedIn": false,
    "isCheckedIn": false,
    "storeId": null,
    "checkedInPickupPointId": null,
    "allowManualPrice": false,
    "canEditData": true,
    "userProfileId": null,
    "userType": null,
    "ignoreProfileData": false,
    "value": 0,
    "messages": [],
    "items": [],
    "selectableGifts": [],
    "totalizers": [],
    "shippingData": null,
    "clientProfileData": {
        "email": null,
        "firstName": null,
        "lastName": null,
        "document": null,
        "documentType": null,
        "phone": null,
        "corporateName": null,
        "tradeName": null,
        "corporateDocument": null,
        "stateInscription": null,
        "corporatePhone": null,
        "isCorporate": false,
        "profileCompleteOnLoading": null,
        "profileErrorOnLoading": null,
        "customerClass": null
    },
...

📘

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

Error code

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.
<body>
    <h1>404 Not Found</h1>
    <p>The requested URL was not found on this server.</p>
</body>