Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 of 5 tasks
seungwooc-23 opened this issue Jul 14, 2022 · 16 comments
Closed
1 of 5 tasks

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

seungwooc-23 opened this issue Jul 14, 2022 · 16 comments
Labels
Area: APIs Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch

Comments

@seungwooc-23
Copy link

seungwooc-23 commented Jul 14, 2022

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”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 14, 2022

Hi @seungwooc-23. Thank you for your report.
To speed up processing of this issue, make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, review the Magento Contributor Assistant documentation.

Add a comment to assign the issue: @magento I am working on this

To learn more about issue processing workflow, refer to the Code Contributions.


⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

🕙 You can find the schedule on the Magento Community Calendar page.

📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

✏️ Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

@m2-assistant
Copy link

m2-assistant bot commented Jul 14, 2022

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
      DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
    1. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@seungwooc-23 seungwooc-23 changed the title Unable to add items with same custom option but different option values with REST API Unable to update cart item's custom option values with REST API Jul 14, 2022
@engcom-Dash engcom-Dash removed their assignment Jul 15, 2022
@engcom-Lima engcom-Lima self-assigned this Jul 15, 2022
@m2-assistant
Copy link

m2-assistant bot commented Jul 15, 2022

Hi @engcom-Lima. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Add label Issue: Confirmed once verification is complete.

  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@seungwooc-23
Copy link
Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @seungwooc-23. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Lima
Copy link
Contributor

Hi @seungwooc-23

Kindly elaborate more about your steps to reproduce for ex-What option type you have choosed to create customizable options of simple product , your post method request body and also provide screeshots of the response that you are getting.

Thank you!!

@engcom-Lima engcom-Lima added the Issue: needs update Additional information is require, waiting for response label Jul 18, 2022
@seungwooc-23
Copy link
Author

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @seungwooc-23. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@seungwooc-23
Copy link
Author

seungwooc-23 commented Jul 18, 2022

Hi @engcom-Lima,

  • The option type chosen is the Text Field type
    The options for SKU 24-MB01 are:
GET https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/rest/default/V1/products/24-MB01/options

[
    {
        "product_sku": "24-MB01",
        "option_id": 1,
        "title": "Option1",
        "type": "field",
        "sort_order": 1,
        "is_require": false,
        "price": 0,
        "price_type": "fixed",
        "max_characters": 0,
        "image_size_x": 0,
        "image_size_y": 0
    }
]
  • The cart item addition is
POST https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/rest/default/V1/guest-carts/g2QC7We6LJGkomp9XI2Tj8ZTjo3Edgtq/items

Request body:
{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1, 
                        "option_value": 1
                    }
                ]
            }
        }
    }
}
  • Cart update call is:
PUT https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/rest/default/V1/guest-carts/g2QC7We6LJGkomp9XI2Tj8ZTjo3Edgtq/items/5

Request body:
{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1, 
                        "option_value": "9999"
                    }
                ]
            }
        }
    }
}
  • List the items on the cart to verify its items:
GET https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/rest/default/V1/guest-carts/g2QC7We6LJGkomp9XI2Tj8ZTjo3Edgtq/items/

Response:
{
    "item_id": 5,
    "sku": "24-MB01",
    "qty": 1,
    "name": "Joust Duffle Bag",
    "price": 34,
    "product_type": "simple",
    "quote_id": "3",
    "product_option": {
        "extension_attributes": {
            "custom_options": [
                {
                    "option_id": "1",
                    "option_value": "1"
                }
            ]
        }
    }
}

@engcom-Lima
Copy link
Contributor

✔️ Issue confirmed

Issue got reproduced in 2.4-develop branch.

Description: Unable to update cart item's custom option values with REST API.

Pre-requisite:
Clean magento should be installed 2.4-develop

Steps to reproduce:

  1. Create simple product using customizable option (text as option type).
  2. Add product to the cart using guest.
  3. Go to db capture quote id masked.
  4. Using post request >> add product to the cart /rest/default/V1/guest-carts/[quoteid_masked]/items
    Request body:
`{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1, 
                        "option_value": 1
                    }
                ]
            }
        }
    }
}`
  1. Update the cart using put method: /rest/default/V1/guest-carts/[quoteid_masked]/items/[itemid]
    Request body:
{
    "cartItem": {
        "sku": "24-MB01",
        "qty": 1,
        "product_option": {
            "extension_attributes": {
                "custom_options": [
                    {
                        "option_id": 1, 
                        "option_value": "9999"
                    }
                ]
            }
        }
    }
}

Expected result: Option value should be updated.
Actual result: Option value was not updated.
Screenshot
Screenshot from 2022-07-19 13-32-47

Hence, confirming the issue.

@engcom-Lima engcom-Lima added Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Area: APIs Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Jul 19, 2022
@m2-community-project m2-community-project bot removed the Issue: needs update Additional information is require, waiting for response label Jul 19, 2022
@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.magento.com/browse/AC-5986 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Jul 19, 2022

✅ Confirmed by @engcom-Lima. Thank you for verifying the issue.
Issue Available: @engcom-Lima, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Jul 19, 2022
@engcom-Lima engcom-Lima added the Reported on 2.4.4 Indicates original Magento version for the Issue report. label Aug 8, 2022
@github-jira-sync-bot github-jira-sync-bot added Progress: PR Created Indicates that Pull Request has been created to fix issue and removed Progress: dev in progress labels Aug 11, 2022
@m2-community-project m2-community-project bot removed the Progress: PR Created Indicates that Pull Request has been created to fix issue label Aug 30, 2022
@hostep
Copy link
Contributor

hostep commented Aug 30, 2022

Closed without a comment?
But I see a bunch of commits mentioning AC-5986, here's the merge commit: 70b864f, so that's probably the fix

@engcom-Hotel
Copy link
Contributor

engcom-Hotel commented Sep 1, 2022

Hello

As I can see this issue got fixed in the scope of the internal Jira ticket AC-5986 by the internal team.
Related commits: https://github.com/magento/magento2/search?q=AC-5986&type=commits

Based on the Jira ticket, the target version is 2.4.6.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: APIs Component: Api Use with concrete module component label E.g. "Component: Api" + "Catalog" Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch
Projects
Archived in project
Development

No branches or pull requests

6 participants