Skip to content

Conversation

ThisIsRuddy
Copy link

@ThisIsRuddy ThisIsRuddy commented Sep 5, 2025

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

Resolved issues:

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

Copy link

m2-assistant bot commented Sep 5, 2025

Hi @ThisIsRuddy. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@ct-prd-pr-scan
Copy link

ct-prd-pr-scan bot commented Sep 5, 2025

The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com.

@ThisIsRuddy ThisIsRuddy closed this Sep 5, 2025
@ThisIsRuddy
Copy link
Author

Signed Adobe CLA

@ThisIsRuddy ThisIsRuddy reopened this Sep 5, 2025
@ct-prd-pr-scan
Copy link

ct-prd-pr-scan bot commented Sep 5, 2025

The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com.

@ThisIsRuddy
Copy link
Author

@magento run all tests

@ThisIsRuddy
Copy link
Author

@magento run all tests

@ThisIsRuddy
Copy link
Author

Since updating the copyright message, the only tests failing seem to be from other commits outside the remit of this PR.

@engcom-Hotel
Copy link
Contributor

@magento create issue

@ct-prd-pr-scan
Copy link

ct-prd-pr-scan bot commented Sep 9, 2025

The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com.

@engcom-Hotel engcom-Hotel added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review
Projects
Status: Pending Review
Development

Successfully merging this pull request may close these issues.

[Issue] Fix: getSalableVariantsByParent hook up cataloginventory/options/show_out_of_stock setting
2 participants