XPM

Cart - Update Cart Items

Path:

PATCH /cart/{cartId}/items

Until billing, users have the flexibility to add (additional items), modify (change the quantity), or remove existing items. This endpoint is designed to ensure the cart is maintained up to date, at any given point.

7.0.1. Headers

Content-Type :application/json

x-site-context :{"date":"2020-05-10T13:16:09.000Z","channel":12}

7.0.2. Consumes

  • application/json

7.0.3. Produces

  • application/json

7.0.4. Parameters

Type: body

Name: Item details

Required: true

7.0.5. 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
}
}
}]
}

7.0.6. Response

Response Code: 200

Message: OK

Description: You will see this message when the changes made to the cart are successfully updated.

Sample

{
"_id": "5e99d75cfcef0314e06b64b8",
"deleted": false,
"allPromosApplied": [],
"cartId": 355,
"items": [
{
"price": {
"discount": {
"promosApplied": [],
"price": 0
},
"validate": true,
"sale": 0,
"base": 260,
"currency": "USD"
},
"group": [
"5ddd1a156c5a5fed1e0d91fb"
],
"createdAt": "2020-04-17T01:02:12.054Z",
"updatedAt": "2020-04-17T16:32:40.241Z",
"_id": "5e99d75cfcef0314e06b64b9",
"itemId": 1000000012,
"quantity": 15,
"sku": "1554369",
"taxCode": "PH060771",
"lineItemId": 1,
"totalPrice": {
"currency": "USD",
"amount": 3900
},
"id": "5e99d75cfcef0314e06b64b9"
},
{
"price": {
"discount": {
"promosApplied": [],
"price": 0
},
"validate": true,
"sale": 0,
"base": 380,
"currency": "USD"
},
"group": [
"5ddd1a156c5a5fed1e0d91fb"
],
"createdAt": "2020-04-17T01:02:12.054Z",
"updatedAt": "2020-04-17T16:32:40.271Z",
"_id": "5e99d75cfcef0314e06b64ba",
"itemId": 1000000014,
"quantity": 15,
"sku": "1539213",
"taxCode": "PH060771",
"lineItemId": 2,
"totalPrice": {
"currency": "USD",
"amount": 5700
},
"id": "5e99d75cfcef0314e06b64ba"
},
{
"price": {
"discount": {
"promosApplied": [],
"price": 0
},
"validate": true,
"sale": 0,
"base": 260,
"currency": "USD"
},
"group": [
"5ddd1a156c5a5fed1e0d91fb"
],
"createdAt": "2020-04-17T01:02:12.054Z",
"updatedAt": "2020-04-17T16:32:40.291Z",
"_id": "5e99d6e2fcef0314e06b64b2",
"itemId": 1000000012,
"quantity": 2,
"sku": "1554369",
"taxCode": "PH060771",
"lineItemId": 3,
"totalPrice": {
"currency": "USD",
"amount": 520
},
"id": "5e99d6e2fcef0314e06b64b2"
},
{
"price": {
"discount": {
"promosApplied": [],
"price": 0
},
"validate": true,
"sale": 0,
"base": 380,
"currency": "USD"
},
"group": [
"5ddd1a156c5a5fed1e0d91fb"
],
"createdAt": "2020-04-17T01:02:12.054Z",
"updatedAt": "2020-04-17T16:32:40.309Z",
"_id": "5e99d6e2fcef0314e06b64b3",
"itemId": 1000000014,
"quantity": 2,
"sku": "1539213",
"taxCode": "PH060771",
"lineItemId": 4,
"totalPrice": {
"currency": "USD",
"amount": 760
},
"id": "5e99d6e2fcef0314e06b64b3"
}
],
"userId": "5e97947d3cb8553c0e43d87f",
"createdAt": "2020-04-17T16:20:44.093Z",
"updatedAt": "2020-04-17T16:32:40.312Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 10880
},
"quantity": 34,
"errors": {
"inventory": [],
"price": []
}
}

7.1. changelog

  • Last Updated - July 2020