delete-user-cart
Method: DELETE
Path: /carts/users/{user_id}
Tags: Carts
Summary
Delete cart using user id
Description
delete all items from the cart using user id.
Storefront SDK Usage
SDK Method: sdk.cart.deleteUserCart()
Example:
typescript
const { data, error } = await sdk.cart.deleteUserCart({
user_id: "01H9USER12345ABCDE"
});
if (error) {
console.error("Failed to delete user cart:", error.message);
} else {
console.log("User cart cleared:", data.message);
}TypeScript Definition
typescript
"delete-user-cart": {
parameters: {
query?: never;
header?: never;
path: {
/** @description User ID */
user_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
/** @example All cart items are removed. */
readonly message: string;
readonly success: boolean;
};
};
};
401: components["responses"]["Unauthorized"];
404: components["responses"]["NotFound"];
};
};Component References
| Reference | Resolves To |
|---|---|
components["responses"]["Unauthorized"] | Unauthorized |
components["responses"]["NotFound"] | NotFound |
Parameters
- user_id (path): User ID
Responses
200
OK
401
Not authorized for given operation on the Resource
404
Requested resource not found
OpenAPI Definition
json
{
"tags": [
"Carts"
],
"operationId": "delete-user-cart",
"summary": "Delete cart using user id",
"description": "delete all items from the cart using user id.",
"externalDocs": {
"url": "https://llm-docs.commercengine.io/storefront/operations/delete-user-cart",
"description": "API reference for the delete-user-cart operation"
},
"parameters": [
{
"name": "user_id",
"in": "path",
"description": "User ID",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"message",
"success"
],
"properties": {
"message": {
"type": "string",
"examples": [
"All cart items are removed."
],
"readOnly": true
},
"success": {
"type": "boolean",
"readOnly": true
}
}
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"404": {
"$ref": "#/components/responses/NotFound"
}
},
"security": [
{
"Authorization": []
}
],
"x-speakeasy-group": "carts",
"x-speakeasy-ignore": false,
"x-speakeasy-name-override": "removeUserCart"
}Auto-generated from OpenAPI spec and TypeScript definitions