Skip to content

Conversation

bordeo
Copy link

@bordeo bordeo commented Mar 13, 2021

New Module to enable MSI for Configurable Product GraphQl

Description

Added a new module to enable MSI for Configurable Product GraphQl.
The Magento_InventoryConfigurableProduct module is overriding the Magento_ConfigurableProduct_Plugin_Model_ResourceModel_Attribute_InStockOptionSelectBuilder plugin, but no module is overriding the Magento_ConfigurableProduct_Plugin_Model_ResourceModel_Attribute_InStockOptionSelectBuilder_GraphQl plugin.
This new module solves the issue.

Fixed Issues

Using graphql to read a configurable product options leads to have an empty array of option values.
This happens because the Magento_ConfigurableProduct_Plugin_Model_ResourceModel_Attribute_InStockOptionSelectBuilder_GraphQl plugin uses a SQL query joining the module-catalog-inventory tables instead the module-inventory tables.

Manual testing scenarios

  1. Create a new inventory source
  2. Create a new inventory stock associated with websites and the new inventory source
  3. Create Configurable Product and variants
  4. Create new “in stock” Source Items on the new Inventory Source for the product variants
    image
  5. Remove Default Source Items
  6. Run graphql
query getProductDetailForProductPage($urlKey: String!) {
  products(filter: { url_key: { eq: $urlKey } }) {
    items {
      id
      ... on ConfigurableProduct {
        configurable_options {
          attribute_code
          attribute_id
          id
          label
          values {
            default_label
            label
            store_label
            use_default_value
            value_index
            swatch_data {
              ... on ImageSwatchData {
                thumbnail
              }
              value
            }
          }
        }
      }
    }
  }
}
  1. products.items.configurable_options.values should return an array of values

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

"magento/module-sales": "*",
"magento/module-inventory-configurable-product": "*",
"magento/module-configurable-product": "*",
"magento/module-configurable-product-graph-ql": "*"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please remove all redundant dependencies?

Alex Bordin added 2 commits March 17, 2021 16:14
…ub.com:bordeo/inventory into module-inventory-configurable-product-graph-ql

* 'module-inventory-configurable-product-graph-ql' of github.com:bordeo/inventory:
  MC-40889: Missing Bundled Products on Category Pages
  MC-40889: Missing Bundled Products on Category Pages
@bordeo bordeo requested a review from sidolov March 17, 2021 15:19
@sidolov
Copy link
Contributor

sidolov commented Mar 17, 2021

@magento run all tests

@sidolov sidolov changed the base branch from 1.2-develop to develop November 11, 2021 17:47
@engcom-Hotel engcom-Hotel moved this to Changes Requested in Inventory - Pull Request Progress Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Changes Requested

Development

Successfully merging this pull request may close these issues.

2 participants