Skip to content

New Module to enable MSI for Configurable Product GraphQl#3299

Closed
bordeo wants to merge 5 commits intomagento:developfrom
bordeo:module-inventory-configurable-product-graph-ql
Closed

New Module to enable MSI for Configurable Product GraphQl#3299
bordeo wants to merge 5 commits intomagento:developfrom
bordeo:module-inventory-configurable-product-graph-ql

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
@engcom-Hotel
Copy link
Collaborator

@magento run all tests

@engcom-Hotel
Copy link
Collaborator

Hello @bordeo,

Thank you for your collaboration!

We have tried to reproduce the issue in the latest development branch, but it seems the issue is not reproducible for us. We have followed the below steps to reproduce the issue:

  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 image image 5. Remove Default Source Items 6. Run graphql ```gql 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 } } } } } } } ``` We can see the `products.items.configurable_options.values` in the output as below:
{
  "data": {
    "products": {
      "items": [
        {
          "uid": "MTIyOQ==",
          "configurable_options": [
            {
              "attribute_code": "attributeset2attribute1",
              "attribute_uid": "MTg1",
              "uid": "Y29uZmlndXJhYmxlLzEyMjkvMTg1",
              "label": "Attribute Set 2 - Attribute 1",
              "values": [
                {
                  "default_label": "Attribute Set 2 - Attribute 1 - Option a",
                  "label": "Attribute Set 2 - Attribute 1 - Option a",
                  "store_label": "Attribute Set 2 - Attribute 1 - Option a",
                  "use_default_value": true,
                  "value_index": 22,
                  "swatch_data": null
                },
                {
                  "default_label": "Attribute Set 2 - Attribute 1 - Option b",
                  "label": "Attribute Set 2 - Attribute 1 - Option b",
                  "store_label": "Attribute Set 2 - Attribute 1 - Option b",
                  "use_default_value": true,
                  "value_index": 23,
                  "swatch_data": null
                },
                {
                  "default_label": "Attribute Set 2 - Attribute 1 - Option c",
                  "label": "Attribute Set 2 - Attribute 1 - Option c",
                  "store_label": "Attribute Set 2 - Attribute 1 - Option c",
                  "use_default_value": true,
                  "value_index": 24,
                  "swatch_data": null
                }
              ]
            }
          ]
        }
      ]
    }
  }
}

It seems the issue has been resolved, hence we are closing this PR.

Thank you

@bordeo
Copy link
Author

bordeo commented Dec 10, 2025

We have tried to reproduce the issue in the latest development branch, but it seems the issue is not reproducible for us. We have followed the below steps to reproduce the issue:

Thank you @engcom-Hotel for reviewing my PR, but it has been open for nearly 5 years. Naturally, the likelihood that this issue has been resolved is very high, so it's not reproducible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants