Delete Cart
Endpoint: DELETE/carts/{session_id}
Purpose
This endpoint is used to delete a specific cart identified by its session ID. It clears the cart from the system, including all associated items and shipping details. This is typically used when a user abandons or resets their cart.
Path Parameters
Parameter | Type | Description |
---|---|---|
session_id | String | The unique identifier of the cart to delete. |
Query Parameters
No query parameters for this endpoint.
Use Case
A user decides to abandon their cart or start over. The system calls this endpoint to permanently delete the existing cart, clearing all products, shipping information, and discounts associated with it. This ensures no stale or incorrect data is retained in the cart.
Request Body
This endpoint does not require a request body.
Response
This endpoint does not return a response body. Upon successful deletion, an HTTP status code 204 No Content
is returned, indicating that the cart has been removed successfully.
Delete Cart Item
Endpoint: DELETE/carts/{session_id}/cart_items/item_id
Purpose
This endpoint deletes a specific item from a cart using the cart’s session ID and the cart item’s ID. It allows users to remove unwanted products from their cart before proceeding to checkout.
Path Parameters
Parameter | Type | Description |
---|---|---|
session_id | String | The unique identifier of the cart to delete. |
cart_item_id | String | The unique identifier for the cart item to delete. |
Query Parameters
No query parameters for this endpoint.
Use Case
A user removes a specific item from their shopping cart before finalizing the purchase. This API ensures that only the selected item is removed without affecting the rest of the cart contents.
Request Body
This endpoint does not require a request body.
Response
This endpoint does not return a response body. Upon successful deletion, an HTTP status code 200 OK
is returned, indicating that the cart item has been deleted successfully.