Magento – Magento 2 REST API: Empty cart or delete multiple items from the cart

cartmagento2rest api

I am working on a headless magento solution, but I am facing a bit of a problem.

As the official magento 2 docs suggest, cart items can be deleted using these:

DELETE /V1/guest-carts/:cartId/items/:itemId -> For Guest Users

DELETE /V1/carts/mine/items/:itemId -> For Signed-in users

Is there a way to delete multiple items without using the same API multiple times, or more conveniently empty the cart?

Best Answer

Magento documentation does not specify an endpoint that allows for bulk deletion. Neither for signed-in users nor guest users.

You can, however, define custom endpoints (see an official documentation page). There's also a tutorial that shows how to do it for bulk edit.

Related Topic