[PaaS only]{class="badge informative" title="Applies to Adobe Commerce on Cloud projects (Adobe-managed PaaS infrastructure) and on-premises projects only."}

ACSD-68499: GraphQL updateCartItems mutation returns success for quantities beyond available stock

The ACSD-68499 patch fixes the issue where the GraphQL updateCartItems mutation returns an incorrect success response when updating quantities that exceed available stock, resulting in inflated quantities and totals. This patch is available when the Quality Patches Tool (QPT) 1.1.74 is installed. The patch ID is ACSD-68499. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.9.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.8-p2

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.4 - 2.4.8-p3
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 GraphQL updateCartItems mutation in Adobe Commerce incorrectly returns success response when updating quantities beyond available stock, causing inflated cart totals and quantities.

Steps to reproduce:

  1. Create an empty cart.

  2. Add a product with limited stock (for example, 10 units available) to the cart.

  3. Query the cart and note the cart_item_id.

  4. Update the cart item quantity to 100 (exceeds available stock of 10) using the following mutation:

    code language-none
    mutation ($cart: String!, $cartItemId: Int!, $quantity: Float!) {
      updateCartItems(
        input: {
          cart_id: $cart
          cart_items: [{ cart_item_id: $cartItemId, quantity: $quantity }]
        }
      ) {
        cart {
          items {
            product {
              name
            }
            quantity
          }
          prices {
            grand_total {
              value
              currency
            }
          }
        }
      }
    }
    
  5. Query the cart again to verify the actual quantity.

Expected results:

Stock validation prevents invalid quantity updates.

Actual results:

The updateCartItems mutation returns success response with a quantity of 100.

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:

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