QUALITY PATCH

ACSD-48627: Out-of-stock configurable product causes an error when sending a GraphQL request to get…

Out-of-stock configurable product causes an error when sending a GraphQL request to get cart details. Quality patch ACSD-48627 for magento/module-catalog-graph-ql applies to Magento Open Source and Adobe Commerce 2.4.3 to 2.4.6-p15.

Categories
GraphQL, Catalog/Product
Components
magento/module-catalog-graph-ql, magento/module-configurable-product, magento/module-configurable-product-graph-ql, magento/module-inventory-catalog
Origin
adobe-commerce-support
Since QPT
1.1.25

Issue

Out-of-stock configurable product causes an error when sending a GraphQL request to get cart details.

Steps to reproduce

1. Create a customer account. 1. Add some products to the cart, including a configurable product. 1. Go to the admin backend, and edit the configurable product by setting all child products qty to 0. 1. The configurable product will become out of stock as all the child products are out of stock. 1. Check the catalog_product_index_price table. The record with this product is empty. 1. Make a GraphQL request to get the customer token. mutation { generateCustomerToken( email: "test@example.com" password: "xxxx" ) { token } } 1. Make a GraphQL request to get cartId. Headers: Authentication => Bearer [customer token in step 6] { customerCart { id items { id product { name sku } quantity } } } 1. Make a GraphQL request to get the cart details. Headers: Authentication => Bearer [customer token in step 6] query GetCartDetails($cartId: String!) { cart(cart_id: $cartId) { id ...CartPageFragment __typename } } fragment CartPageFragment on Cart { id total_quantity ...AppliedCouponsFragment ...ProductListingFragment ...PriceSummaryFragment __typename } fragment AppliedCouponsFragment on Cart { id applied_coupons { code __typename } __typename } fragment ProductListingFragment on Cart { id items { uid product { uid name sku url_key url_suffix thumbnail { url __typename } small_image { url __typename } stock_status price_range { minimum_price { final_price { currency value __typename } regular_price { currency value __typename } __typename } __typename } stock_status ... on ConfigurableProduct { variants { attributes { uid __typename } product { uid small_image { url __typename } stock_status __typename } __typename } __typename } __typename } prices { price { currency value __typename } __typename } quantity ... on ConfigurableCartItem { configurable_options { id configurable_product_option_uid option_label configurable_product_option_value_uid value_label __typename } __typename } __typename } __typename } fragment PriceSummaryFragment on Cart { id items { uid quantity __typename } ...ShippingSummaryFragment prices { ...TaxSummaryFragment ...DiscountSummaryFragment ...GrandTotalFragment subtotal_excluding_tax { currency value __typename } subtotal_including_tax { currency value __typename } __typename } __typename } fragment DiscountSummaryFragment on CartPrices { discounts { amount { currency value __typename } label __typename } __typename } fragment GrandTotalFragment on CartPrices { grand_total { currency value __typename } __typename } fragment ShippingSummaryFragment on Cart { id shipping_addresses { selected_shipping_method { amount { currency value __typename } __typename } street __typename } __typename } fragment TaxSummaryFragment on CartPrices { applied_taxes { amount { currency value __typename } __typename } __typename }

Adobe's page lists 2.4.5 - 2.4.5-p1 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.6.

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 ACSD-48627. On Cloud, add ACSD-48627 under stage.build.QUALITY_PATCHES in .magento.env.yaml.

For cweagans/composer-patches, choose a compatible version below and download the bundle. Copy its ACSD-48627/ 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

Packages across compatible versions (4): magento/module-catalog-graph-ql, magento/module-configurable-product, magento/module-configurable-product-graph-ql, magento/module-inventory-catalog
Packages across compatible versions (4): magento/module-catalog-graph-ql, magento/module-configurable-product, magento/module-configurable-product-graph-ql, magento/module-inventory-catalog

magento/magento2-base >=2.4.3 <2.4.4

Magento Open Source
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Adobe Commerce
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Requires
MDVA-43862, MDVA-40488
Patch file
patches/os/ACSD-48419_2.4.3-p3.patch
  • vendor/magento/module-catalog-graph-ql/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/StockProcessor.php
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsCompositeFilter.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsFilterInterface.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsProvider.php
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsStatusFilter.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsStockStatusFilter.php (added)
  • vendor/magento/module-configurable-product/etc/di.xml
  • vendor/magento/module-configurable-product/etc/frontend/di.xml
  • vendor/magento/module-configurable-product-graph-ql/Model/Options/DataProvider/Variant.php
  • vendor/magento/module-configurable-product-graph-ql/Model/Resolver/Product/Price/Provider.php
  • vendor/magento/module-configurable-product-graph-ql/Plugin/AddStockStatusToCollection.php (added)
  • vendor/magento/module-configurable-product-graph-ql/etc/graphql/di.xml

magento/magento2-base >=2.4.4 <2.4.4-p18

Magento Open Source
2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
Adobe Commerce
2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
Requires
MDVA-43862
Patch file
patches/os/ACSD-50591_2.4.4-p1.patch
  • vendor/magento/module-catalog-graph-ql/Model/Resolver/Products/DataProvider/Product/CollectionProcessor/StockProcessor.php
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsCompositeFilter.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsFilterInterface.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsProvider.php
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsStatusFilter.php (added)
  • vendor/magento/module-configurable-product/Pricing/Price/ConfigurableOptionsStockStatusFilter.php (added)
  • vendor/magento/module-configurable-product/etc/di.xml
  • vendor/magento/module-configurable-product/etc/frontend/di.xml
  • vendor/magento/module-configurable-product-graph-ql/Model/Options/DataProvider/Variant.php
  • vendor/magento/module-configurable-product-graph-ql/Model/Resolver/Product/Price/Provider.php
  • vendor/magento/module-configurable-product-graph-ql/Plugin/AddStockStatusToCollection.php (added)
  • vendor/magento/module-configurable-product-graph-ql/etc/graphql/di.xml

magento/magento2-base >=2.4.5 <2.4.6

Magento Open Source
2.4.5-p17, 2.4.5-p16, 2.4.5-p15, 2.4.5-p14, 2.4.5-p13, 2.4.5-p12, 2.4.5-p11, 2.4.5-p10, 2.4.5-p9, 2.4.5-p8, 2.4.5-p7, 2.4.5-p6, 2.4.5-p5, 2.4.5-p4, 2.4.5-p3, 2.4.5-p2, 2.4.5-p1, 2.4.5
Adobe Commerce
2.4.5-p17, 2.4.5-p16, 2.4.5-p15, 2.4.5-p14, 2.4.5-p13, 2.4.5-p12, 2.4.5-p11, 2.4.5-p10, 2.4.5-p9, 2.4.5-p8, 2.4.5-p7, 2.4.5-p6, 2.4.5-p5, 2.4.5-p4, 2.4.5-p3, 2.4.5-p2, 2.4.5-p1, 2.4.5
Patch file
patches/os/ACSD-48627_2.4.5-p1.patch
  • vendor/magento/module-configurable-product-graph-ql/Model/Resolver/Product/Price/Provider.php

magento/magento2-base >=2.4.6 <2.4.7

Magento Open Source
2.4.6-p15, 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6
Adobe Commerce
2.4.6-p15, 2.4.6-p14, 2.4.6-p13, 2.4.6-p12, 2.4.6-p11, 2.4.6-p10, 2.4.6-p9, 2.4.6-p8, 2.4.6-p7, 2.4.6-p6, 2.4.6-p5, 2.4.6-p4, 2.4.6-p3, 2.4.6-p2, 2.4.6-p1, 2.4.6
Patch file
patches/os/ACSD-57880_2.4.6-p3.patch
  • vendor/magento/module-configurable-product-graph-ql/Model/Resolver/Product/Price/Provider.php

magento/inventory-metapackage >=1.2.3 <1.2.4

Magento Open Source
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Adobe Commerce
2.4.3-p3, 2.4.3-p2, 2.4.3-p1, 2.4.3
Patch file
patches/os/ACSD-48419_1.2.3-p2.patch
  • vendor/magento/module-inventory-catalog/Model/ResourceModel/AddStockDataToCollection.php

magento/inventory-metapackage >=1.2.4 <1.2.5

Magento Open Source
2.4.4-p18, 2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
Adobe Commerce
2.4.4-p18, 2.4.4-p17, 2.4.4-p16, 2.4.4-p15, 2.4.4-p14, 2.4.4-p13, 2.4.4-p12, 2.4.4-p11, 2.4.4-p10, 2.4.4-p9, 2.4.4-p8, 2.4.4-p7, 2.4.4-p6, 2.4.4-p5, 2.4.4-p4, 2.4.4-p3, 2.4.4-p2, 2.4.4-p1, 2.4.4
Patch file
patches/os/ACSD-50591_1.2.4-p1.patch
  • vendor/magento/module-inventory-catalog/Model/ResourceModel/AddStockDataToCollection.php

Sources

Łukasz Bajsarowicz
Built by

Łukasz Bajsarowicz, e-commerce architect

Magento and Adobe Commerce architecture, upgrades, performance and audits for merchants and agencies since 2015; magento.watch is the tooling I use on those projects.

Open source, maintained on weekends.