Magento 2 GraphQL Catalog Visibility Bug: Child Products Not Showing with 'Catalog' Visibility

Magento 2 GraphQL Visibility Bug Affecting Child Products

A confirmed bug in Magento 2.4.8-p3 affects product retrieval via GraphQL when using specific visibility settings. The issue, reported by zexperto on GitHub (issue #40451), centers around configurable products and their child products when visibility is set to 'Catalog'.

The Problem: When a configurable product has its visibility set to 'Catalog', its child products, even if they also have 'Catalog', 'Search' or 'Catalog, Search' visibility, are not returned in GraphQL queries using the product's URL key.

Steps to Reproduce:

  1. Create a configurable product with Visibility = Catalog.
  2. Create child products (e.g., with different colors) and set their visibility to 'Catalog'.
  3. Execute a GraphQL query to retrieve a child product by its URL key:
query Products {
 products(search: "{child_sku}", filter: { url_key: { eq: "{child_url_key}" } }) {
 total_count
 items {
 sku
 }
 }
}

This query will not return the child product.

Observed Behavior:

  • Child products with 'Catalog' visibility are not returned when the configurable product's visibility is also 'Catalog'.
  • Changing the configurable product's visibility to 'Search' or 'Catalog, Search' makes the configurable product (but not the child) appear in the GraphQL results.
  • Changing the child product visibility to 'Search' makes both the configurable and child products appear.

Explanation and Impact:

zexperto clarified that the GraphQL query, while named with "search", is intended for direct product retrieval using the URL key, not for replicating storefront search behavior. Products with 'Catalog' visibility are enabled, have a valid product detail page (PDP), and are accessible via direct URL. Therefore, they should be retrievable via GraphQL when queried by URL key, regardless of their appearance in storefront search results.

The current behavior introduces inconsistencies, as the configurable product's visibility influences the GraphQL result set for child products, even when the child products have different visibility settings. This is unexpected and undocumented.

Expected Behavior:

Any simple product (including a configurable child) that is enabled and has 'Catalog', 'Search', or 'Catalog, Search' visibility should be retrievable via GraphQL when explicitly filtered by URL key. Failure to do so makes it impossible to reliably resolve PDPs in headless implementations.

Status:

The Magento team has confirmed the issue (AC-16394) and it is now in their backlog.

Start with the tools

Explore migration tools

See options, compare methods, and pick the path that fits your store.

Explore migration tools