DELETE /cart/{order}/items

Last updated on
30 August 2018
Clears a cart of its order items

Example curl command
curl 'http://localhost:32775/cart/2/items?_format=json' -X DELETE

No response is returned, only HTTP 204.

You will have to re-fetch the user's cart via /cart/{order}?_format=json.

Per https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html and https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/DELETE the DELETE method may return a response. However, the core rest.module will not allow us to return a body (the format of the request gets lost in \Drupal\rest\EventSubscriber\ResourceResponseSubscriber::getResponseFormat.)

Help improve this page

Page status: No known problems

You can: