ACSD-48627: out-of-stock configurable product causes an error

The ACSD-48627 patch fixes the issue where the out-of-stock configurable product causes an error when sending a GraphQL request to get cart details. This patch is available when the Quality Patches Tool (QPT) 1.1.25 is installed. The patch ID is ACSD-48627. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.6.

Affected products and versions

The patch is created for Adobe Commerce version:

  • Adobe Commerce (all deployment methods) 2.4.5-p1

Compatible with Adobe Commerce versions:

  • Adobe Commerce (all deployment methods) 2.4.5 - 2.4.5-p1
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

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.

  2. Add some products to the cart, including a configurable product.

  3. Go to the admin backend, and edit the configurable product by setting all child products qty to 0.

  4. The configurable product will become out of stock as all the child products are out of stock.

  5. Check the catalog_product_index_price table. The record with this product is empty.

  6. Make a GraphQL request to get the customer token.

    code language-graphql
    mutation {
        generateCustomerToken(
            email: "test@example.com"
            password: "xxxx"
            ) {
                token
                }
                }
    
  7. Make a GraphQL request to get cartId.

    code language-graphql
    Headers: Authentication => Bearer [customer token in step 6]
    
    code language-graphql
    {
        customerCart {
            id
            items {
                id
                product {
                    name
                    sku
                    }
                    quantity
                    }
                    }
                    }
    
  8. Make a GraphQL request to get the cart details.

    code language-graphql
    Headers: Authentication => Bearer [customer token in step 6]
    
    code language-graphql
    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
                                                                                                                                                                }
    

Expected results:

No Internal server error in the response.

Actual results:

There is an Internal server error in the response.

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
8bd06ef0-b3d5-4137-b74e-d7b00485808a