Skip to content

API add to cart with simple product but different options increases qty instead of adding new cart item #32302

Closed
@DavidLambauer

Description

@DavidLambauer

We're trying to add the same simple product into the cart, but with custom options through the api. The expected result would be to have 2 items in the cart with different custom options. Actual result is the first item is in cart with qty of 2.

Preconditions

Magento Version 2.4.2

Steps to reproduce

You might want to check the video attached below

Capto_Capture.2021-02-26_01-44-29_PM.mp4

.

  1. Create a cart via rest call: POST | {{ base_url }}guest-carts
  2. Receive the cart to make sure no items are in the cart: GET | {{ base_url }}guest-carts/cartId
  3. Add a simple product with custom options to the cart: POST | {{ base_url }}guest-carts/cartId/items

Example Payload:

{
  "cartItem": {
    "sku": "THE-SKU-OF-YOUR-SIMPLE-PRODUCT",
    "qty": 1,
    "product_option": {
      "extension_attributes": {
        "custom_options": [
          {
            "option_id": "1",
            "option_value": "abc"
          },
          {
            "option_id": "2",
            "option_value": "abc"
          }
        ]
      }
    },
    "quoteId": "YOUR-QUOTE-ID"
  }
}
  1. (optional) Re-do step 2 to validate that the product was added to the cart.
  2. Re-do step 3 but change the custom option values in the payload.
  3. Re-do step 2 to again to see that two different products got merged into one but the qty was increased.

Expected result (*)

Actual result (*)

The cart should contain two items, each one with the custom options that were selected.


Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

Labels

Component: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: Cannot ReproduceCannot reproduce the issue on the latest `2.4-develop` branchIssue: needs updateAdditional information is require, waiting for responsePriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.2Indicates original Magento version for the Issue report.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions