magento2
magento2 copied to clipboard
Unable to update cart item's custom option values with REST API
Preconditions and environment
- Magento CE version 2.4.4
- Component: REST API
Steps to reproduce
- Create a simple product in the catalog with a customizable option
Using the Magento REST API:
- 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"
}
]
}
}
}
}
- 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
}
]
}
}
}
}
- 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.
- [X] 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”.
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.
- Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: 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.
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
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: :point_down:
-
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears.
- Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
-
- Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself.
- Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
-
- Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to.
- Add
-
- Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced 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!
- Verify that the issue is reproducible on
- Join Magento Community Engineering Slack and ask your questions in #github channel.
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: :point_down:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced 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: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
@magento give me 2.4-develop instance
Hi @seungwooc-23. Thank you for your request. I'm working on Magento instance for you.
Hi @seungwooc-23, here is your Magento Instance: https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering Admin access: https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/admin_64d0 Login: ea61718b Password: a50033b6d9c9
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!!
@magento give me 2.4-develop instance
Hi @seungwooc-23. Thank you for your request. I'm working on Magento instance for you.
Hi @seungwooc-23, here is your Magento Instance: https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering Admin access: https://7f9f88ea28e9b8b7a2a492289744a5e4.instances.magento-community.engineering/admin_f945 Login: faef9ce6 Password: 62989efa6452
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"
}
]
}
}
}
:heavy_check_mark: 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:
- Create simple product using customizable option (text as option type).
- Add product to the cart using guest.
- Go to db capture quote id masked.
- Using post request >> add product to the cart
/rest/default/V1/guest-carts/[quoteid_masked]/itemsRequest body:
`{
"cartItem": {
"sku": "24-MB01",
"qty": 1,
"product_option": {
"extension_attributes": {
"custom_options": [
{
"option_id": 1,
"option_value": 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

Hence, confirming the issue.
:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-5986 is successfully created for this GitHub issue.
:white_check_mark: 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.
Closed without a comment? But I see a bunch of commits mentioning AC-5986, here's the merge commit: https://github.com/magento/magento2/commit/70b864f4b103800784397f14b2887b25e619fad3, so that's probably the fix
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