Skip to content

Unable to update cart item's custom option values with REST API #35768

@seungwooc-23

Description

@seungwooc-23

Preconditions and environment

  • Magento CE version 2.4.4
  • Component: REST API

Steps to reproduce

  1. Create a simple product in the catalog with a customizable option

Using the Magento REST API:

  1. Create a cart for checkout (POST /rest/default/V1/guest-carts/) and add a cart item of the product created in step 1
POST /rest/default/V1/guest-carts/{cartId}/items request body:
{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1, 
                        "option_value": "1"
                    }
                ]
            }
        }
    }
}
  1. Specify a new option_value in the payload and perform PUT /rest/default/V1/guest-carts/{cartId}/items/{itemId} with the following request body:
{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1,
                        "option_value": 999
                    }
                ]
            }
        }
    }
}
  1. Retrieve the cart items by doing a GET on rest/default/V1/guest-carts/{cartId}/items/

Expected result

The custom option_value for the option_id should be updated after step 3.

Actual result

Only the custom option_value of the first-added cart item does not get updated after the PUT request.

Additional information

I've reproduced this behavior on the 2.4-develop branch using the instance provided by magento-deployment-service

Release note

No response

Triage and priority

  • 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

No one assigned

    Labels

    Area: APIsComponent: ApiUse with concrete module component label E.g. "Component: Api" + "Catalog"Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: doneReported on 2.4.4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions