ACP2E-4840: GraphQL products query returns null quantity for in-stock products on custom inventory stocks
The ACP2E-4840 patch fixes the issue where the quantity field in the products GraphQL query returns null for products that are in stock and available for sale on custom inventory stocks. This patch is available when the Quality Patches Tool (QPT) 1.1.82 is installed. The patch ID is ACP2E-4840. Please note that this issue is scheduled to be fixed in Adobe Commerce 2.4.10.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.8-p4
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.8 - 2.4.8-p5
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 quantity field in the products GraphQL query returns null for products that are in stock and available for sale on custom inventory stocks.
Prerequisites:
MSI is enabled.
Steps to reproduce:
-
Create a new source.
-
On the Admin sidebar, go to Stores > Inventory > Stock.
-
Click Add New Stock.
-
Expand Sales Channels and select the Websites where the stock is available.
-
Expand Sources, click Assign Sources, select the source that you want to assign, and click Done.
-
On the Admin sidebar, go to Catalog > Products and open an existing product in edit mode.
-
In the Sources section, assign the custom source, set Source Item Status to In Stock, enter a non-zero value for Qty, and save the product.
-
Confirm in Catalog > Products that the product shows a non-zero Salable Quantity for the website assigned to the custom stock.
-
Run the following
productsGraphQL query for that SKU against the store view assigned to the website that uses the custom stock:code language-none query { products(filter: { sku: { in: ["product_dynamic_1"] } }) { items { sku name stock_status quantity max_sale_qty } } } -
Observe the response:
code language-none { "data": { "products": { "items": [ { "sku": "product_dynamic_1", "name": "Simple Product 1", "stock_status": "IN_STOCK", "quantity": null, "max_sale_qty": 10000 } ] } } }
Expected results:
The GraphQL response returns a non-null quantity value for products that are in stock and salable on the current store/website.
Actual results:
The GraphQL response returns quantity = null while stock_status = IN_STOCK for products that are in stock and salable in the Admin when the store uses a custom MSI stock.
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide