Standarize the order items API responses.

Created on 28 April 2021, over 3 years ago
Updated 6 December 2024, 16 days ago

Problem/Motivation

There is not a consistent way to operate on a cart's items and get the modified cart back in response.

  • Adding items to cart is only possible by posting to /cart/add, that can add to multiple orders, so it can not respond with an updated cart.
  • Removing from cart responds with nothing.
  • Updating order items responds with the whole cart.

This causes pain when trying to consume the API.

Proposed resolution

  • Make the DELETE request to /cart/{commerce_order}/items/{commerce_order_item} endpoint respond with the updated cart.
  • Create the ability to add items to a single order by making a POST request to /cart/{commerce_order}/items and make that endpoint respond with the updated cart.

API changes

  • Response to DELETE requests to /cart/{commerce_order}/items/{commerce_order_item} will change. This should not be a braking change at most cases, since the current response is empty.
  • The ability to make POST requests to /cart/{commerce_order}/items will be added.
Feature request
Status

Needs work

Version

1.0

Component

Code

Created by

🇬🇷Greece s.messaris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024