Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. The Developer Center continues to support Commerce 6.13.0 through 7.4.1.Visit new site

Remove Cart Item

Remove Cart Item

There are two ways to remove an item from a cart:

DELETE the lineitem

Deleting a cart's lineitem deletes the lineitem, thereby removing all the items in the lineitem. Once the lineitem is deleted, Cortex returns status 204 and a link to the lineitem that was deleted.
  1. GET the cart
  2. GET the cart's lineitems
  3. Call DELETE the lineitem remove_item_from_cart

PUT (Update) the cart

This URI updates the number of items in a lineitem. For example, if you have 4 Rockstar T-Shirts in a lineitem, you can use this method to remove 3 of the t-shirts, which leaves 1 T-shirt in the cart. The request body sets the number of items in the lineitem. For example, if you have 4 items and you specify {"quantity":1}, then you will have one item in the lineitem. Another example is if you have 4 items and you specify {"quantity":10}, then you will have ten items in the lineitem.

  1. GET the cart
  2. GET the cart's lineitems
  3. GET - a cart's lineitem
  4. PUT to the lineitem to update it (shown below) put_to_update_lineitem