Documentation
Feedback
Guides
API Reference

Guides
Getting Started

Integration Guides




Payments

Orders

Fulfillment

VTEX inStore

UI Customization

Message Center

Pricing

Promotions

Infrastructure

Conversational Commerce

Search

VTEX Session

CheckoutCart Attachments
Add merchant context data to the cart

The shopping cart is where the information of 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 add any relevant information related to the context of a specific order to a shopping cart via the API.

Getting shopping cart information

The first step is to get the orderFormId of the shopping cart you want to add the merchant context data to. For more information, access the Get cart information by ID guide.

Adding merchant context data to the shopping cart

To add merchant context data to the shopping cart, you need to use the Add merchant context data endpoint. In this request, you must send the orderFormId through the URL address, as shown by the example below:

https://{accountName}.{environment.com.br}/api/checkout/pub/orderForm/ede846222cd44046ba6c638442c3505a/attachments/merchantContextData

Additionally, you need to send the request with the merchant context data within the salesAssociateData object . See a request body example containing the vendor (seller) identification code:

{ "salesAssociateData": { "salesAssociateId": "seller123" } }

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

... "merchantContextData": { "salesAssociateData": { "salesAssociateId": "seller123" } } ...

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

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.
{ "fields": {}, "error": { "code": "ORD002", "message": "Invalid order form", "exception": null }, "operationId": "5d9f54e6-7db4-46d6-bca9-deeb278b8b98" }

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>
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Was this helpful?
Yes
No
Suggest edits (Github)
Add payment data
Configuration
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page