XM
Members
Empty Cart
This documentation is now outdated, please find the latest docs for this endpoint here
Path:
1
PATCH https://{baseurl}/api-cart/api-cart/cart/{cartId}/empty
Copied!
Allows emptying of the cart based on the specified cart ID. In this case, the cart continues to exist, but with 0 item in it. For deleting the cart altogether, the Delete Cart endpoint 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 cartID (from the Add Items to Cart or Retrieve Cart by userAuthToken API)
Required: true

Sample Request

Path:
1
https://{baseurl}/api-cart/cart/60806e0b2b71680009000e0d/empty
Copied!

Sample Response

Response Code: 200
Message: OK
Description: You'll see this message when the cart is successfully emptied.
1
{
2
"_id": "60806e0b2b71680009000e0d",
3
"deleted": false,
4
"registeredUser": false,
5
"cartId": 1491,
6
"items": [],
7
"allPromosApplied": [],
8
"attributes": [],
9
"createdAt": "2021-04-21T18:25:15.947Z",
10
"updatedAt": "2021-04-21T19:05:50.431Z",
11
"__v": 0,
12
"totalAmount": {
13
"currency": "",
14
"amount": 0
15
},
16
"quantity": 0
17
}
Copied!
Response Code: 404
Message: Not found
Description: You will see this error when the cart ID doesn't exist in the system.
1
{
2
"code": "CART_NOT_FOUND",
3
"message": "Cart not found."
4
}
Copied!
Response Code: 400
Message: Request validation
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!
Response Code: 400
Message: Bad Request
Description: You will see this error when the cart is already empty.
1
{
2
"code": "EMPTY_CART_ERROR",
3
"message": "The cart is already empty."
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
  • July - 2020 First updated
Last modified 1mo ago
Copy link
Contents
Change Log