Skip to main content

Version: v1

Delete Cart

Completely removes an existing cart from the system.


HTTP Method & Endpoint

DELETE | /cart/{cartId}


Request

Path Parameters

ParameterTypeRequiredDescription
cartIdStringYesUnique identifier of the cart to delete

Headers

HeaderValueDescription
AuthorizationBearer {token}Authentication token (replace {token} with your actual token)
x-store-id{storeId}StoreId (replace {storeId} with your actual storeId)

Response Format

Success Response (200 OK)

FieldTypeDescription
messageStringStatus message indicating the result of the operation
dataObjectEmpty object
sourceStringSource of the operation (e.g., "db")

Examples

cURL

curl -X DELETE "https://dev-sfapi.unisouk.com/cart/33863324215067648" \
-H "Authorization: Bearer <TOKEN>" \
-H "x-store-id: <STORE_ID>"

JavaScript (React)

import axios from "axios";

const deleteCart = async (cartId) => {
try {
const response = await axios.delete(`https://dev-sfapi.unisouk.com/cart/${cartId}`, {
headers: {
Authorization: "Bearer <TOKEN>",
"x-store-id": "<STORE_ID>",
},
});

console.log("Cart deleted successfully:", response.data);
} catch (error) {
console.error("Error deleting cart:", error.response?.data || error.message);
}
};

// Example usage
deleteCart("cart_PhIidALwQ8JFCBOU");

Sample Response

{
"message": "Cart Deleted Successfully",
"data": {},
"source": "db"
}

Error Responses

Status CodeDescription
400Bad Request - Invalid cart ID format
401Unauthorized - Authentication token is missing or invalid
403Forbidden - User does not have permission to delete this cart
404Not Found - Cart with the specified ID was not found
500Internal Server Error - Something went wrong on the server

Notes

  • This operation permanently deletes the cart and all its items. This action cannot be undone.
  • If you want to empty a cart but keep the cart itself, consider using the Remove Item endpoint for all items instead.