Magento 2 Wishlist Bug: How a Rejected Item Can Block All Future Additions

Unpacking a Persistent Wishlist Bug in Magento 2.4.x

The wishlist feature is a cornerstone of any successful e-commerce platform, allowing customers to save products they love for future purchases. It's a critical component for fostering customer loyalty and driving conversions. However, even core functionalities can sometimes harbor subtle yet impactful bugs. This community insight from Shopping Mover delves into a specific issue reported on GitHub that highlights a significant flaw in the Magento 2.4.x wishlist functionality, particularly affecting guest users.

The Core Problem: A Stubborn Wishlist Rejection

Issue #41822, titled "A rejected guest wishlist replay prevents the next valid add," describes a scenario where a seemingly minor interaction can lead to a persistent problem. The bug manifests when a guest user attempts to add an unavailable product to their wishlist, then signs in, and subsequently tries to add a valid, in-stock product.

Steps to Reproduce the Issue:

  • Step 1: As a guest, navigate to an unavailable product (Product A) and click "Add to Wish List." Keep the sign-in page open.
  • Step 2: Disable Product A in the Magento Admin panel, ensuring Product B remains enabled and in stock.
  • Step 3: Sign in using the original guest session. Magento attempts to replay the pending wishlist request for Product A, resulting in the message: "We can't specify a product."
  • Step 4: Now, open Product B (which is enabled and in stock) and click "Add to Wish List."

Expected Result: The system should successfully add Product B to the wishlist and display a success message, leaving the wishlist with Product B.

Actual Result: Despite Product B being valid, Magento repeats the error message "We can't specify a product." The wishlist remains stubbornly empty, failing to add Product B.

The Technical Deep Dive: Why This Happens

The issue author, atIOCrON, provided a crucial clue regarding the bug's root cause. They observed that the Magento controller prioritizes a stored request, specifically when a beforeWishlistUrl marker is present. The critical flaw is that the system's rejection of the unavailable product (Product A) occurs before this marker is cleared. Consequently, subsequent valid attempts to add products (like Product B) are still blocked by the uncleared, rejected request marker.

Impact on User Experience and Merchants

This bug, though specific in its trigger, has significant implications:

  • Frustrated Customers: Users encountering this bug will likely be confused and frustrated. They might perceive the wishlist feature as broken, leading to a negative user experience.
  • Lost Sales Opportunities: If customers cannot reliably add items to their wishlist, they might abandon their shopping session, resulting in lost potential sales for merchants.
  • Brand Reputation: Persistent issues with core functionalities can erode customer trust and negatively impact a store's brand reputation.

Community Response and Status

The Magento community has been responsive to this report. The issue was quickly confirmed by engcom-Bravo on a 2.4-develop instance, indicating its presence in recent Magento 2.4.x versions. A Jira issue (AC-19776) has been successfully created, marking it for further investigation and resolution by Adobe Commerce engineers. While no immediate fix or workaround is provided within the GitHub comments, the confirmation is a vital step towards a resolution.

What This Means for Magento Users and Developers

For merchants running Magento Open Source 2.4.x, awareness of this bug is key. While waiting for an official patch, monitoring user reports for similar issues could be beneficial. For developers, this insight points to a specific area (wishlist controller logic, particularly around session management and request markers like beforeWishlistUrl) that might require closer examination, especially when implementing custom wishlist functionalities or debugging related issues.

At Shopping Mover, we understand the importance of a seamless e-commerce experience. Bugs like this underscore the value of active community engagement and thorough testing, particularly during Magento migrations, to ensure that core features function flawlessly from day one.

Start with the tools

Explore migration tools

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

Explore migration tools