Skip to content

[Issue] Fix: getSalableVariantsByParent hook up cataloginventory/options/show_out_of_stock setting #40182

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #40175: Fix: getSalableVariantsByParent hook up cataloginventory/options/show_out_of_stock setting


Issue

The function getSalableVariantsByParent does not abide by the admin setting cataloginventory/options/show_out_of_stock
When OOS is set to Yes, the resolver does not return OOS variants.

Resolution

Load in config scope interface and pull value and apply to filters

Debug/Replication

Toggle show/hide oos items via magento admin config and check results contain stock_status = OUT_OF_STOCK or not

query DebugStockVariants($sku: String!) {
  products(filter: {sku: {eq: $sku}}) {
    items {
      __typename
      uid
      sku
      name
      
      ... on SimpleProduct {
        quantity
        only_x_left_in_stock
        stock_status
      }

      ... on ConfigurableProduct {
        variants {
          product {
            name
            sku
            quantity
            only_x_left_in_stock
            stock_status
          }
        }
      }
    }
  }
}

Select some options and check variant results abides by admin setting

query DebugConfigurableOptions($urlKey: String!, $selectedOptions: [ID!] = []) {
  products(filter: {url_key: {eq: $urlKey}}) {
    items {
      ... on ConfigurableProduct {
        configurable_product_options_selection(
          configurableOptionValueUids: $selectedOptions
        ) {
          configurable_options {
            attribute_code
            values {
              label
              uid
            }
          }
          options_available_for_selection {
            attribute_code
            option_value_uids
          }
        }
      }
    }
  }
}

(patch attached for convinence)

magento-module-configurable-product-graph-ql-get-available-selections.patch

Metadata

Metadata

Labels

Issue: needs updateAdditional information is require, waiting for responseReported on 2.4.xIndicates original Magento version for the Issue report.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions