ACP2E-4840: The quantity field in the products GraphQL query returns null for products…
The quantity field in the products GraphQL query returns null for products that are in stock and available for sale on custom inventory stocks. Quality patch ACP2E-4840 for magento/module-catalog-inventory-graph-ql applies to Magento Open Source and Adobe Commerce 2.4.8 to 2.4.8-p5.
- Categories
- GraphQL, Catalog/Product
- Components
- magento/module-catalog-inventory-graph-ql, magento/module-quote-graph-ql
- Origin
- adobe-commerce-support
- Since QPT
- 1.1.82
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.
Steps to reproduce
1. Create a new source. 1. On the Admin sidebar, go to Stores > Inventory > Stock. 1. Click Add New Stock. 1. Expand Sales Channels and select the Websites where the stock is available. 1. Expand Sources, click Assign Sources, select the source that you want to assign, and click Done. 1. On the Admin sidebar, go to Catalog > Products and open an existing product in edit mode. 1. 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. 1. Confirm in Catalog > Products that the product shows a non-zero Salable Quantity for the website assigned to the custom stock. 1. Run the following products GraphQL query for that SKU against the store view assigned to the website that uses the custom stock: query { products(filter: { sku: { in: ["product_dynamic_1"] } }) { items { sku name stock_status quantity max_sale_qty } } } 1. Observe the response: { "data": { "products": { "items": [ { "sku": "product_dynamic_1", "name": "Simple Product 1", "stock_status": "IN_STOCK", "quantity": null, "max_sale_qty": 10000 } ] } } }
Adobe's page lists 2.4.8 - 2.4.8-p5 as compatible; the versions below are resolved from the current QPT constraints and are the ones the tool will offer.
Adobe scheduled the permanent fix for 2.4.10.
Install
Install the Quality Patches Tool with composer require magento/quality-patches, apply the prerequisites listed for all files applicable to your distribution and version first, then run vendor/bin/magento-patches apply ACP2E-4840. On Cloud, add ACP2E-4840 under stage.build.QUALITY_PATCHES in .magento.env.yaml.
For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACP2E-4840/ folder into patches/composer/, merge composer.patches.json into composer.json, then run composer install. Bundle prerequisites the same way and list them first. Paths are relative to each package root, using the default -p1 level. Prefer local files when configuring composer-patches; a remote URL can change.
Patch files and compatible versions
magento/magento2-base >=2.4.8 <2.4.9
- Patch file
- patches/os/ACP2E-4842_2.4.8-p4.patch
- vendor/magento/module-catalog-inventory-graph-ql/Model/Resolver/QuantityResolver.php
- vendor/magento/module-quote-graph-ql/Model/CartItem/ProductStock.php
