XM

Update Cart

Path:

PATCH https://{baseurl}/api-cart/cart-decoupled/{cartId}/items

The ideal use case is to allow your customers to decrement the quantity of an item in their cart, any time before billing.

To add new items or increment item quantity, the Add Items to Cart API is recommended. To remove existing items, the Remove Item from Cart API is recommended.

Headers

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

Parameters

Type: requestBody

Name: The details of the items to be updated in the cart.

Required: true

Sample Request

{
"items": [{
"lineItemId": 1,
"itemId": "1000000012",
"quantity": 15,
"price": {
"currency":"USD",
"sale": 0,
"base": 260,
"discount": {
"price": 0
}
}
},
{
"lineItemId": 2,
"itemId": "1000000014",
"quantity": 15,
"price": {
"currency":"USD",
"sale": 0,
"base": 380,
"discount": {
"price": 0
}
}
}]
}

Sample Response

Response Code: 200

Message: OK

{
"_id": "60803e46630ef900087e2f61",
"deleted": false,
"registeredUser": false,
"cartId": 1488,
"items": [
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 0,
"base": 19,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"5ecef789df21ae00077e7a2f"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T14:54:05.290Z",
"updatedAt": "2021-04-21T14:54:05.290Z",
"_id": "60803e46630ef900087e2f63",
"itemId": 1000000040,
"sku": "sk231212",
"taxCode": "123455123",
"title": "fabric t-shirt",
"weight": 4.2,
"quantity": 2,
"lineItemId": 1,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 38
},
"attributes": [],
"id": "60803e46630ef900087e2f63"
},
{
"price": {
"discount": {
"discountAmount": 0,
"price": 0,
"promosApplied": []
},
"sale": 0,
"base": 19,
"currency": "USD"
},
"sample": false,
"discountedQuantity": 0,
"group": [
"5ecef789df21ae00077e7a2f"
],
"weightUnit": "lb",
"isPickup": false,
"createdAt": "2021-04-21T14:54:05.290Z",
"updatedAt": "2021-04-21T15:07:36.374Z",
"_id": "60803e46630ef900087e2f62",
"itemId": 1000000167,
"sku": "sk231212",
"taxCode": "TC1234567890",
"title": "fabric t-shirt",
"weight": 4.2,
"quantity": 9,
"lineItemId": 2,
"attributeTotalPrice": 0,
"totalPrice": {
"currency": "USD",
"amount": 171
},
"attributes": [],
"priceListId": null,
"id": "60803e46630ef900087e2f62"
}
],
"allPromosApplied": [],
"attributes": [],
"createdAt": "2021-04-21T15:01:26.051Z",
"updatedAt": "2021-04-21T15:07:36.411Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 209
},
"quantity": 11,
"errors": []
}

Response Code: 400

Message: Bad Request - Cart Doesn't Exist

Error Code: 403

Message: Forbidden

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

{
"message": "Forbidden"
}

Change Log

  • June - 2021

  • July - 2020 First updated

‚Äč