Delete a Cart

Endpoint Overview

This endpoint allows you to delete a user's shopping cart from your Venddor store. This operation is useful for clearing abandoned carts or resetting a customer's shopping session.

DELETE /api/carts/{user_id}

Deletes the cart associated with the specified user ID.

Path Parameters

Parameter Type Required Description
user_id integer Yes The unique identifier of the user whose cart you want to delete.

Example Request

DELETE /api/carts/3

This request deletes the cart for the user with user_id=3.

Response

The endpoint returns no content on successful deletion, only a status code indicating success.

Response Status Codes

Status Code Description
204 No Content The cart has been deleted successfully.
404 Not Found The specified cart doesn't exist or has already been deleted.

Implementation Notes

When using the Delete Cart endpoint, consider the following use cases and best practices:

Important: Deleting a cart is permanent and cannot be undone. Make sure you have a backup or are certain you want to remove the cart before proceeding with this operation.
Tip: If you're looking to simply empty a cart rather than delete it entirely, consider using a PUT request to update the cart with an empty products array instead.