Magento GraphQL can return not only the data of a configurable product but also its configurable attributes and associated child products.

For example, the query might look like this:

The expression … on ConfigurableProduct is an inline fragment. A normal products query can return different product types; the fragment requests additional fields that exist only on configurable products.

The field configurable_options returns configurable attributes and their possible values. Under variants you can access the associated simple products, including their SKUs and stock status.

A response could look like this:

You can then process the data in your frontend, for example filtering the response to include only available variants:

The resulting example contains only the available child product:

A single GraphQL query can therefore return both the configurable product and the structure of its options and variants, useful when building a custom storefront.

GraphQL: Querying Variants of a Configurable Product
Need help implementing this solution, or still looking for a fix to your Magento problem? Get in touch and I will be happy to help with your project.
Tags: