XPM

Cart - Retrieve Cart by Cart or User ID

Path:

GET /cart?cartId={cartId/userId}

Once, the items are added to the cart, a user's cart details can be retrieved through this endpoint, by specifying the cartId or the userId in the request path. The User ID is used when the cart is created from the logged in user's account.

Headers

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

Consumes

  • application/json

Produces

  • application/json

Parameters

Type : path

Name : cartId or userId

Required: true

Sample Request

By CartId

https://{baseurl}/cart?cartId=5f13883765bc750008b58293

By UserId

https://{baseurl}/cart?userId=5e990062fcef0314e06b649f

Response

Response Code: 200

Message: OK

Description: You'll see this message when the cart details are successfully retrieved.

Sample

{
"_id": "5f13883765bc750008b58293",
"deleted": false,
"registeredUser": false,
"cartId": 1534,
"items": [
{
"price": {
"discount": {
"price": 0,
"discountAmount": 0,
"promosApplied": []
},
"sale": 68,
"base": 85,
"currency": "USD"
},
"discountedQuantity": 0,
"group": [
"5e31a1f9fcc2b500089c10e8"
],
"weightUnit": "lb",
"createdAt": "2020-07-18T22:19:41.035Z",
"updatedAt": "2020-07-18T23:44:19.858Z",
"_id": "5f13889465bc750008b58297",
"itemId": 1000000038,
"quantity": 2,
"sku": "1554213",
"taxCode": "PH060771",
"title": "Glo Pillow Light Gray",
"weight": 2,
"lineItemId": 1,
"totalPrice": {
"currency": "USD",
"amount": 136
},
"id": "5f13889465bc750008b58297"
}
],
"userId": "5f138820708ffb0007e609b0",
"allPromosApplied": [],
"createdAt": "2020-07-18T23:39:35.978Z",
"updatedAt": "2020-07-18T23:44:19.878Z",
"__v": 0,
"totalAmount": {
"currency": "USD",
"amount": 136
},
"quantity": 2,
"errors": {
"inventory": [],
"price": [],
"promo": []
}
}

Changelog

  • Last updated - July 2020