Open csmcneill opened 1 month ago
Some additional information:
- Merchant likely added custom currency via a plugin or code - Singapore_Custom
- WooPayments saves the ID code of the custom currency in DB and uses get_woocommerce_currencies() core method to retrieve name of the currency using that saved ID
- Important part is that if the custom currency code declaration is removed - WooPayment will throw an error because get_woocommerce_currencies() will no longer include the custom currency in the array and function get_name() in WooPayments returns a blank. (error thrown because of type declaration string)
- We don't know yet if it was added via code or plugin but basically should yield same results.
Thank you for moving this to the right repo, @csmcneill!
Originally reported in https://github.com/woocommerce/woocommerce/issues/47793 — moving here since the issue seems to be rooted in WooPayments (cc @AashikP @kaushikasomaiya)
Describe the bug
If you use a custom currency, and then remove the code declaration for that custom currency, WooPayments will throw a Fatal Error.
To Reproduce
Actual behavior
WooPayments relies on the
wcpay_multi_currency_store_currency
database entry to guess the custom currency.Screenshots
Expected behavior
WooCommerce itself reverts back to the first currency in the list if the code declaration for the custom currency is not available. WooPayments should either use that logic or look at store currency.
Additional context
p1716534045942739-slack-C3NCP7ZJ6 p1692737131166069-slack-C3NCP7ZJ6