MDVA-43862: customer can’t update cart items because of a GraphQL UpdateCartItems mutation error
The MDVA-43862 patch solves the issue where the customer can’t update cart items because of a GraphQL UpdateCartItems mutation error. This patch is available when the Quality Patches Tool (QPT) 1.1.13 is installed. The patch ID is MDVA-43862. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.5.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.3-p1, 2.4.2-p2
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.3.3 - 2.4.4
magento/quality-patches
package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
The customer can’t update cart items because of a GraphQL UpdateCartItems mutation error.
Steps to reproduce:
-
Create a configurable product (MH01) by assigning one simple (MH01-XL-Gray).
-
Go to the Commerce Admin > Catalog > Products > SKU > MH01 > Customizable Options.
-
Add a custom option to the product.
- Option Title: Option1
- Option Type: Field
- Required: Yes
- Price: 10.00
- Price Type: Fixed
- SKU: MHC1
- Max Characters: 25
-
Run the below GraphQL query to generate cart ID.
code language-graphql mutation { createEmptyCart }
-
Make a note of the cart ID code.
-
Run the below query to add configurable product to the cart:
code language-graphql mutation { addConfigurableProductsToCart( input: { cart_id: "<cart ID from above step>", cart_items: [{ parent_sku: "MH01", data: { quantity: 1, sku: "MH01-XL-Gray" }, customizable_options: { id: 1, value_string: "2" } } ] } ) { cart { items { uid quantity product { name sku } ... on ConfigurableCartItem { configurable_options { option_label } } } } } }
-
You will notice that the cart is populated with the configurable item.
-
Make a note of the uid returned.
-
Again, run the below query to update the cart item.
code language-graphql mutation { updateCartItems( input: { cart_id: "<cart ID from previous step>", cart_items: [ { cart_item_uid: "<uid from previous step>" quantity: 3, customizable_options:[{ id: 1, value_string: "67" }] } ] } ){ cart { items { uid product { name } quantity } prices { grand_total{ value currency } } } } }
-
Observe the response.
Expected results:
The cart is updated without any issue.
Actual results:
You get the following error:
{
"errors": [
{
"message": "Could not update cart item: You need to choose options for your item.",
"extensions": {
"category": "graphql-input"
},
"locations": [
{
"line": 2,
"column": 3
}
],
"path": [
"updateCartItems"
]
}
],
"data": {
"updateCartItems": null
}
}
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Software Update Guide > Apply Patches in our developer documentation.
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in our developer documentation.
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool released: a new tool to self-serve quality patches in our support knowledge base.
- Check if patch is available for your Adobe Commerce issue using Quality Patches Tool in our support knowledge base.
For info about other patches available in QPT, refer to Patches available in QPT in our developer documentation.