4b69392f93b9
Add line items to a cart
Use this method to add or update one or more products in a cart. Adding a product to a cart creates a corresponding line item. You can update one or more line items using the productID or externalReferenceID query parameter. Alternatively, you can post multiple line items with a single request with an XML payload in the request body. The method behavior differs depending on which action query mechanism you use to post line items to a cart. The action query parameter provides flexibility for the update behavior. Add is the default action for this method.
Query parameters
Provide the authorized or anonymous token for a shopper.
Provide the identifier for the company that owns the product. If you do not provide the companyId, the call will use the default company associated with the API key.
Provide a comma-separated list of one or more external reference identifiers. The externalReferenceId is your company's internal identifier or stock keeping unit (SKU) for a product used when creating a line item with companyId. If you do not explicitly provide the companyId when creating a line item using the externalReferenceId, the system will use the companyId associated with the API key.
Provide the offer's identifier.
Provide a comma-separated list of one or more product IDs. A product identifier is a product's unique stock keeping unit (SKU). Use this product ID when adding a product to a cart and creating a line item.
Provide the line item ID for the parent product when adding a child product to the cart to ensure the child product is correctly associated with the parent product line item. Remember also to include the offer ID.
Provide the number of products added to the cart. The value must be a valid integer. If the quantity is not explicitly specified, the default is 1.
When set to true, this parameter suppresses an order's confirmation email. To use this feature, contact Customer Success.
Request body
Example request
{
"lineItems": {
"lineItem": {
"id": "991101014",
"quantity": "1",
"product": {
"id": 1234
},
"pricing": {
"salePrice": {
"currency": "USD",
"value": "10.99"
}
},
"customAttributes": {
"attribute": [
{
"name": "name",
"value": "string",
"type": "string"
}
]
}
}
}
}Response
Successful response.