Magento 2 GraphQL Wishlist Bug: Configurable Variant Not Returning Correctly

As e-commerce platforms evolve, GraphQL has become a cornerstone for building flexible and high-performance headless storefronts on Magento 2. However, even established APIs can sometimes harbor unexpected behaviors. A recent GitHub issue (Issue #40588) highlights a significant bug in Magento 2.4.7-p6 EE concerning the addProductsToWishlist GraphQL mutation, specifically when dealing with configurable products.

The Unexpected Null: Configured Variant Missing in Wishlist Response

The core of the problem lies in the addProductsToWishlist mutation. When a user adds a specific variant (child product) of a configurable product to their wishlist, the expectation is that the GraphQL response will include details about that selected variant. Specifically, the configured_variant field within the ConfigurableWishlistItem type should return the SKU of the chosen child product.

However, users on Magento 2.4.7-p6 EE have reported that this field consistently returns null, despite the product being successfully added to the wishlist. This discrepancy means that while the item is saved, the API response doesn't provide the necessary information about which specific configuration (e.g., "red" vs. "blue" for a shirt) was added, which can be critical for frontend display or subsequent processing.

Reproducing the Bug

The issue was clearly demonstrated with a simple GraphQL mutation:

mutation {
  addProductsToWishlist(
    wishlistId: "1"
    wishlistItems: [
        {
        parent_sku: "Test1"
        sku: "Test-red"
        quantity: 2
      }
 
    ]
  ) {
    wishlist {
      items_v2(currentPage: 1, pageSize: 8) {
        items {
          id
          __typename
          ... on ConfigurableWishlistItem {
            configured_variant {
              sku
            }
          }
        }
      }
    }
    user_errors {
      code
      message
    }
  }
}

The expected outcome was to receive the sku of the configured_variant. Instead, the actual result showed:

{
    "data": {
        "addProductsToWishlist": {
            "wishlist": {
                "items_v2": {
                    "items": [
                        {
                            "id": "1",
                            "__typename": "ConfigurableWishlistItem",
                            "configured_variant": null
                        }
                    ]
                }
            },
            "user_errors": []
        }
    }
}

Community Confirmation and Impact

The issue, initially reported by aakashs11042k, quickly garnered attention and was confirmed by the Magento engineering team (engcom-Bravo). It was successfully reproduced on a clean Magento 2.4-develop instance, solidifying its status as a legitimate bug within the platform. The issue has been labeled as "Confirmed," "Reproduced on 2.4.x," and assigned a "P2" priority, indicating its importance.

For developers building custom Magento storefronts or integrating with third-party systems via GraphQL, this bug can pose challenges. Relying on the configured_variant field for displaying accurate wishlist item details or for further processing (e.g., moving to cart with correct variant pre-selected) would lead to errors or incomplete information. While the item is added, the lack of immediate feedback on the specific configuration can degrade user experience or complicate frontend logic.

What This Means for Your Magento Store

  • For Developers: If your headless Magento or custom application utilizes the addProductsToWishlist GraphQL mutation and expects the configured_variant in the response, be aware that this field will currently return null on Magento 2.4.7-p6 and potentially other 2.4.x versions. You may need to implement a workaround to fetch the variant details separately after the item is added, or adjust your frontend logic to handle this missing data until a patch is released. Keep an eye on the official GitHub issue for updates and potential fixes.
  • For Merchants: While this is a technical bug, it can indirectly impact the user experience of your headless store. Ensure your development team is aware of this issue and has strategies in place to manage wishlist display and functionality if your store relies on this specific GraphQL response.

At Shopping Mover, we understand that such core platform bugs can introduce complexities, especially during migrations or when maintaining advanced e-commerce setups. Staying informed about these issues is crucial for ensuring the stability and accuracy of your Magento 2 operations.

Start with the tools

Explore migration tools

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

Explore migration tools