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
NOTE
The patch might become applicable to other versions with new Quality Patches Tool releases. To check if the patch is compatible with your Adobe Commerce version, update the 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:

  1. Create a configurable product (MH01) by assigning one simple (MH01-XL-Gray).

  2. Go to the Commerce Admin > Catalog > Products > SKU > MH01 > Customizable Options.

  3. 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
  4. Run the below GraphQL query to generate cart ID.

    code language-graphql
    mutation {
      createEmptyCart
    }
    
  5. Make a note of the cart ID code.

  6. 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
          }
        }
      }
    }
    }
    }
    
  7. You will notice that the cart is populated with the configurable item.

  8. Make a note of the uid returned.

  9. 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
            }
          }
        }
      }
    }
    
  10. 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:

To learn more about Quality Patches Tool, refer to:

For info about other patches available in QPT, refer to Quality Patches Tool: Search for patches in the Quality Patches Tool guide.

recommendation-more-help
c2d96e17-5179-455c-ad3a-e1697bb4e8c3