Removing products from cart
How to remove an item from your shopping cart

Problem

You have some items in your shopping cart and you want to remove one of them.
A sample cart item removal

Solution

Removing a product (SKU) from your shopping cart means deleting an existing line item. To do that, send a DELETE request to the /api/line_items/:id endpoint.

Example

Request
Response
The following request removes the line item identified by the "aBmNkPQRst" ID from your shopping cart:
1
curl -g -X DELETE \
2
'http://yourdomain.commercelayer.io/api/line_items/aBmNkPQRst' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
Copied!
On success, the API responds with a 204 No Content status code.

More to read

See our documentation if you need more information on how to delete a line item.