XM
Powered By GitBook
Add Attributes To Cart Items
Path:
1
PATCH https://{baseurl}/api-cart/cart/{cartId}/item/attribute
Copied!
Enables your customers to opt for additional services (such as gift wrapping) for one or more items within a cart.

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/5f8f0d82d4cc8e00084b9e8e/item/attribute
Copied!
Request Body:
1
[
2
{
3
"lineItemId": 2,
4
"attributeId": "6092cba26fe410000872bc62",
5
"attributeValue": "true"
6
}
7
]
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": "60b132ee41b0a000089fafda",
3
"deleted": false,
4
"registeredUser": false,
5
"cartId": 1092,
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-28T18:33:50.644Z",
26
"updatedAt": "2021-05-28T18:40:28.791Z",
27
"_id": "60b1378f33ce7300086e67bd",
28
"itemId": 1000000050,
29
"quantity": 2,
30
"priceListId": 100000,
31
"sku": "WATCH123456",
32
"taxCode": "PAC12345",
33
"title": "Watch",
34
"weight": 2,
35
"lineItemId": 1,
36
"attributeTotalPrice": 50,
37
"totalPrice": {
38
"currency": "USD",
39
"amount": 2000
40
},
41
"attributes": [
42
{
43
"price": 25,
44
"_id": "60b139053e2387000936c48e",
45
"attributeId": "6092cba26fe410000872bc62",
46
"value": "true",
47
"name": "Gift Wrap",
48
"type": "bool",
49
"id": "60b139053e2387000936c48e"
50
}
51
],
52
"id": "60b1378f33ce7300086e67bd"
53
},
54
{
55
"price": {
56
"discount": {
57
"discountAmount": 0,
58
"price": 0,
59
"promosApplied": []
60
},
61
"sale": 0,
62
"base": 1000,
63
"currency": "USD"
64
},
65
"sample": false,
66
"discountedQuantity": 0,
67
"group": [
68
"123123123123123213212222"
69
],
70
"weightUnit": "kg",
71
"isPickup": false,
72
"createdAt": "2021-05-28T18:14:06.199Z",
73
"updatedAt": "2021-05-28T18:40:28.791Z",
74
"_id": "60b132ee41b0a000089fafdb",
75
"itemId": 1000000033,
76
"quantity": 2,
77
"priceListId": 100000,
78
"sku": "SHIRT001",
79
"taxCode": "TAX001",
80
"title": "Shirt",
81
"weight": 60,
82
"lineItemId": 2,
83
"attributeTotalPrice": 50,
84
"totalPrice": {
85
"currency": "USD",
86
"amount": 2000
87
},
88
"attributes": [
89
{
90
"price": 25,
91
"_id": "60b1391c3e2387000936c490",
92
"attributeId": "6092cba26fe410000872bc62",
93
"value": "true",
94
"name": "Gift Wrap",
95
"type": "bool",
96
"id": "60b1391c3e2387000936c490"
97
}
98
],
99
"id": "60b132ee41b0a000089fafdb"
100
}
101
],
102
"allPromosApplied": [],
103
"attributes": [],
104
"createdAt": "2021-05-28T18:14:06.542Z",
105
"updatedAt": "2021-05-28T18:40:28.804Z",
106
"__v": 0,
107
"totalAmount": {
108
"currency": "USD",
109
"amount": 4100
110
},
111
"quantity": 4,
112
"errors": {
113
"inventory": [],
114
"price": [],
115
"promo": []
116
}
117
}
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: 500
Message: Internal Server Error
Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

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