Magento 2 Bug Alert: Auto-Generated SKUs Erasing Product Relations

Managing product data efficiently is paramount for any e-commerce business, especially when dealing with unique or used inventory. Magento 2 offers robust catalog management features, but a recent GitHub issue highlights a significant bug that could lead to frustrating data loss for merchants relying on specific product duplication and SKU generation workflows.

The Unexpected Loss: When Magento 2 Auto-Generates SKUs and Erases Relations

A community member, operating a used camera shop, reported a critical issue (GitHub #41808) affecting Magento 2.4.9 and potentially earlier versions (since 2.3.7). The core problem revolves around Magento's automatic SKU generation process and its detrimental impact on product relationships like related products, up-sells, and cross-sells.

The merchant's workflow involves duplicating existing product listings for unique used items. Instead of manually creating a brand new SKU for each duplicated item, they follow a pattern: they assign a base monthly SKU (e.g., "SKU-2611") to the duplicated product, expecting Magento to automatically append a unique identifier (e.g., "SKU-2611-1", "SKU-2611-2") if the base SKU already exists. This approach streamlines their inventory management for one-off items.

However, the bug manifests precisely when Magento is forced to auto-generate a unique SKU. Here’s the sequence of events that triggers the data loss:

  1. A product exists with pre-configured related products, up-sells, and cross-sells.
  2. The product is duplicated. Magento typically appends "-1" to the SKU (e.g., "SKU-2610-43" becomes "SKU-2610-43-1").
  3. Crucially, the user then manually changes the SKU of the duplicated product back to an existing SKU (e.g., "SKU-2610-43" again). This action is intended to force Magento to recognize the conflict and auto-generate a truly unique SKU (e.g., "SKU-2610-43-2" or similar).
  4. Upon saving the product, Magento successfully generates a new, unique SKU as expected. However, all previously assigned related products, up-sells, and cross-sells are inexplicably erased.

Impact and Confirmation

For merchants, this bug translates into significant manual effort. Each time a product is duplicated and its SKU is auto-generated under these specific conditions, the vital product relationships – which are key for increasing average order value and improving customer experience – must be manually re-assigned. This not only consumes valuable time but also introduces the risk of errors and oversight, potentially impacting sales and customer engagement.

The issue has been categorized with a Severity S2, indicating that it affects non-critical data or functionality but forces users to employ a workaround. The good news is that the Magento engineering team has confirmed the bug. An Adobe Commerce engineer (engcom-Bravo) successfully reproduced the issue on a "Latest 2.4-develop instance," validating the community member's report and confirming that "After saving the product up-sells, cross-sells and related products are gone."

What This Means for Magento Users

This confirmed bug underscores the importance of careful product data management, especially during large-scale migrations or when implementing specific inventory workflows. While a direct fix is pending, users employing similar duplication and auto-SKU generation strategies should be aware of this behavior. Possible workarounds include:

  • Always ensuring a truly unique SKU is provided for duplicated products, rather than relying on Magento to resolve conflicts by auto-generating.
  • Saving and re-applying related product data after an auto-generated SKU save, though this adds manual overhead.
  • Exploring alternative methods for managing unique inventory items that don't trigger this specific SKU auto-generation conflict.

For businesses undergoing Magento migration or those already on Magento 2.3.7 or newer, understanding such nuances is vital for maintaining data integrity and operational efficiency. We recommend monitoring the GitHub issue for updates and potential fixes from the Magento core team.

Start with the tools

Explore migration tools

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

Explore migration tools