Magento 2 Multi-Currency Bug: Payment Failed Emails Display Incorrect Totals
Navigating Multi-Currency Challenges: A Critical Magento 2 Bug Explained
For e-commerce businesses operating across international borders, a robust multi-currency setup is not just a feature—it's a necessity. Magento 2 offers powerful capabilities for handling multiple currencies, allowing merchants to cater to a global customer base. However, a recent GitHub issue (#40534) highlights a significant bug in Magento Open Source 2.4.7-p2 that could lead to customer confusion and erode trust: 'Payment Failed' emails are displaying the store's base currency instead of the actual currency used by the customer during checkout.
The Core Issue: Currency Mismatch in Payment Failed Emails
The problem, reported by patelkevin985, surfaces in Magento 2 stores configured with different base and display/quote currencies. When a customer places an order in a display currency (e.g., EUR) that differs from the store's base currency (e.g., USD), and their payment subsequently fails, the automated 'Payment Failed' email incorrectly shows the total in the base currency (USD) rather than the currency the customer saw and used during the checkout process (EUR). This discrepancy can be highly confusing for customers, leading to increased support queries and a perception of inaccuracy.
Preconditions for the Bug:
- Magento Open Source version: 2.4.7-p2 (likely affects other versions with similar logic)
- PHP version: 8.3
- Multi-currency store configuration enabled
- Base currency is different from display/quote currency
- Payment failure emails are enabled
Example Scenario:
If your store's Base Currency is USD and the Display Currency is EUR, a customer checking out in EUR will receive a payment failed email showing 'USD 120.00' instead of the expected 'EUR 120.00'.
Technical Deep Dive: The Root Cause
The issue's author pinpointed the exact line of code responsible for this misrepresentation. It appears the email template or logic responsible for populating the 'total' variable in the email is incorrectly calling $quote->getCurrency()->getStoreCurrencyCode(), which retrieves the base currency code, instead of $quote->getQuoteCurrencyCode(), which would correctly fetch the currency used in the customer's quote.
The proposed fix is straightforward:
- 'total' => $quote->getCurrency()->getStoreCurrencyCode() . ' ' . $quote->getGrandTotal(),
+ 'total' => $quote->getQuoteCurrencyCode() . ' ' . $quote->getGrandTotal(),This change ensures that the currency displayed in the email accurately reflects the currency the customer interacted with during their purchase attempt.
Impact on Merchants and Customer Experience
While classified as an S3 severity (affecting non-critical functionality without forcing a workaround), the impact of this bug should not be underestimated. Inaccurate financial communication can severely damage customer trust. Imagine a customer seeing a different currency in a critical email than what they used on the website – it immediately raises red flags about the transaction's legitimacy and the store's professionalism. For merchants, this translates to:
- Increased customer service inquiries and operational overhead.
- Potential for abandoned carts or loss of repeat business due to perceived unreliability.
- Damage to brand reputation, especially for international businesses.
Community Engagement and Next Steps
As of now, the issue has been reported and acknowledged by the Magento Contributor Assistant bot, which has provided standard instructions for reproducibility and contribution. There are no immediate solutions or workarounds provided in the comments, indicating that this is still an active bug awaiting community contribution or an official patch from Adobe Commerce.
For Magento users, developers, and merchants, this highlights the importance of staying vigilant with bug reports and community discussions. While waiting for an official fix, developers might consider implementing a temporary patch in their custom modules or themes to override the problematic logic, ensuring accurate currency display in these crucial transactional emails.
At Shopping Mover, we understand the complexities of Magento environments, especially when dealing with multi-currency setups and the critical need for accurate customer communication. Issues like this underscore the importance of thorough testing and, for those considering migrations, the value of a platform that prioritizes consistent and reliable user experiences.