XM
Members
Add Attributes to Cart
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
PATCH https://{baseurl}/api-cart/cart/{cartId}/attribute
Copied!
Enables your customers to opt for additional services (such as gift wrapping) at cart-level. If a gift-wrapping service is selected at the cart-level, all the items in the cart are wrapped in a single gift wrap.
To avail the same gift wrap service for one or more items in the cart (not all), the Add Attributes To Cart Items API is recommended.

Headers

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

Parameters

Type: Path
Name: The 24 character system-generated cart ID (from the Add Items to Cart or Retrieve Cart by userAuthToken API).
Required: true
Type: Body
Name: The attribute details.
Required: true

Sample Request

Path:
1
PATCH https://{baseurl}/api-cart/cart/{cartId}/attribute
Copied!
Request Body:
1
[
2
{
3
"attributeId": "60b12fdda12cde00081b4f80",
4
"attributeValue":"false"
5
}
6
]
Copied!

Response

Success Code: 200
Message: OK
Description: You'll see this message when the stripe payment is successfully added to the cart.
1
{
2
"_id": "60b12e29fbe918000871a8c7",
3
"deleted": false,
4
"registeredUser": false,
5
"cartId": 1091,
6
"items": [
7
{
8
"price": {
9
"discount": {
10
"discountAmount": 0,
11
"price": 0,
12
"promosApplied": []
13
},
14
"sale": 0,
15
"base": 1000,
16
"currency": "USD"
17
},
18
"sample": false,
19
"discountedQuantity": 0,
20
"group": [
21
"123123123123123213212222"
22
],
23
"weightUnit": "kg",
24
"isPickup": false,
25
"createdAt": "2021-05-28T17:48:03.398Z",
26
"updatedAt": "2021-05-28T18:13:50.078Z",
27
"_id": "60b12e29fbe918000871a8c8",
28
"itemId": 1000000033,
29
"quantity": 2,
30
"priceListId": 100000,
31
"sku": "SHIRT001",
32
"taxCode": "TAX001",
33
"title": "Shirt",
34
"weight": 60,
35
"lineItemId": 1,
36
"attributeTotalPrice": 0,
37
"totalPrice": {
38
"currency": "USD",
39
"amount": 2000
40
},
41
"attributes": [],
42
"id": "60b12e29fbe918000871a8c8"
43
}
44
],
45
"allPromosApplied": [],
46
"attributes": [
47
{
48
"price": 5,
49
"_id": "60b132d69ea1b200097f513b",
50
"attributeId": "60b12fdda12cde00081b4f80",
51
"value": "true",
52
"name": "Complete Order Gift Warp Small",
53
"type": "bool",
54
"id": "60b132d69ea1b200097f513b"
55
}
56
],
57
"createdAt": "2021-05-28T17:53:45.750Z",
58
"updatedAt": "2021-05-28T18:13:50.089Z",
59
"__v": 0,
60
"totalAmount": {
61
"currency": "USD",
62
"amount": 2005
63
},
64
"quantity": 2,
65
"errors": {
66
"inventory": [],
67
"price": [],
68
"promo": []
69
}
70
}
Copied!
Error Code: 404
Message: Not found
Description: You will see this error when the cart ID doesn't exist in the system.
1
{
2
"message": "Cart not found.",
3
"statusCode": 404,
4
"code": "ATTRIBUTE_ERROR"
5
}
Copied!
Error Code: 400
Message: Bad Request
Description: You will see this error when the cart ID is lesser or greater than 24 characters.
1
{
2
"code": "REQUEST_VALIDATION",
3
"message": "Invalid data in path: /cartId should NOT be shorter than 24 characters"
4
}
Copied!
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).
1
{
2
"message": "Forbidden"
3
}
Copied!

Change Log

  • June - 2021 First updated
Last modified 1mo ago
Copy link
Contents
Change Log