XM

Add ship-to to Line Items

Path:

PATCH /cart/{cartId}/ship-to

Users may have the requirement to ship items in the cart to multiple locations. This API facilitates adding shipping details for each line item in the cart.

Note: Postal address is required only for physical items; for digital items, email address would suffice.

Headers

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

Consumes

  • application/json

Produces

  • application/json

Parameters

Type: Path

Name: cartId

Required: true

Type: body

Name: Ship To details (itemId, lineItemId, and shipToId)

Required: true

Sample Request

Path:

https://{baseurl}/api-cart/cart/5e99d75cfcef0314e06b64b8/ship-to

Body:

[
{
"itemId": 1000000012,
"lineItemId": 1,
"shipToId": "5e99dd58fcef0314e06b64fe"
},
{
"itemId": 1000000014,
"lineItemId": 2,
"shipToId": "5e99dd58fcef0314e06b64fe"
},
{
"itemId": 1000000012,
"lineItemId": 3,
"shipToId": "5e99dd58fcef0314e06b64fe"
},
{
"itemId": 1000000014,
"lineItemId": 4,
"shipToId": "5e99dd58fcef0314e06b64fe"
}
]

Response

Response Code: 200

Message: OK

{
"_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:33:21.191Z",
"_id": "5e99d75cfcef0314e06b64b9",
"itemId": 1000000012,
"quantity": 15,
"sku": "1554369",
"taxCode": "PH060771",
"lineItemId": 1,
"totalPrice": {
"currency": "USD",
"amount": 3900
},
"shipTo": "5e99dd58fcef0314e06b64fe",
"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:33:21.212Z",
"_id": "5e99d75cfcef0314e06b64ba",
"itemId": 1000000014,
"quantity": 15,
"sku": "1539213",
"taxCode": "PH060771",
"lineItemId": 2,
"totalPrice": {
"currency": "USD",
"amount": 5700
},
"shipTo": "5e99dd58fcef0314e06b64fe",
"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:33:21.231Z",
"_id": "5e99d6e2fcef0314e06b64b2",
"itemId": 1000000012,
"quantity": 2,
"sku": "1554369",
"taxCode": "PH060771",
"lineItemId": 3,
"totalPrice": {
"currency": "USD",
"amount": 520
},
"shipTo": "5e99dd58fcef0314e06b64fe",
"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:33:21.249Z",
"_id": "5e99d6e2fcef0314e06b64b3",
"itemId": 1000000014,
"quantity": 2,
"sku": "1539213",
"taxCode": "PH060771",
"lineItemId": 4,
"totalPrice": {
"currency": "USD",
"amount": 760
},
"shipTo": "5e99dd58fcef0314e06b64fe",
"id": "5e99d6e2fcef0314e06b64b3"
}
],
"userId": "5e97947d3cb8553c0e43d87f",
"createdAt": "2020-04-17T16:20:44.093Z",
"updatedAt": "2020-04-17T17:06:03.833Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 10880
},
"quantity": 34
}

Response Code: 404

Message: Not Found

Description: You will see this message when the cart is not found, either due to incorrect cartId/lineItemId.

Changelog

  • April-2021 last updated

  • July-2020 First updated