Skip to content

Introduce separate POST and PUT API for carts/mine/items #28162

Open
@ldc321

Description

@ldc321

Description

Currently, there is no way to set exact number of cart items. The POST request is adding posted quantity to existing quantity in the cart. The idea is to introduce ability to rewrite the items with PUT request

Steps to reproduce (*)

70096:ItemId already exists and qty=3
can{{t update cart items when set Maximum Qty Allowed in Shopping Cart
1.POST:http://xxxxxx.com/rest/V1/carts/mine/items
2.body:{"cartItem":{"sku":"AM-OL-I3T-CA-OS","qty":4,***"item_id":70096,_**"quoteId":"3xxx45","product_option":{"extension_attributes":{"custom_options":<],"configurable_item_options":[{"option_id":"93","option_value":"66"}],"bundle*options":[>}}}}
3.set Maximum Qty Allowed in Shopping Cart=6

If I do post, I get an error:The requested qty exceeds the maximum qty allowed in shopping cart
tips: If oldQty is 3, postQty is 2, final qty is 2, there is no problem!
if oldQty is 3, postQty is 4, I get an error:The requested qty exceeds the maximum qty allowed in shopping cart

Expected result (*)

Update: after review this issue expected result was updated #28162 (comment)

Desire state should be
POST }}carts/mine/items- add item(s). If called several times - increment Qty PUT carts/mine/items` - add item(s). If called several times - each time overwrite previously created item.

  1. I want to change the qty of products in the cart 3 to 4
  1. It should be overwrite, not increment

Actual result (*)

  1. I get an error:The requested qty exceeds the maximum qty allowed in shopping cart

Metadata

Metadata

Assignees

Labels

Component: WebapiUse with concrete module component label E.g. "Component: Webapi" + "Catalog"Priority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: PR in progressProgress: ready for groomingTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itfeature request

Type

No type

Projects

Status

In Progress

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions