Skip to content

Commit b7e0cfc

Browse files
Mayishawjrosamalithsen
authored
Fix page crash when klarna not supported in the country (#4430)
* fix page crash when klarna not supported in the country * add changelog * keep the message in console error * Update readme.txt Co-authored-by: Malith Senaweera <[email protected]> --------- Co-authored-by: Wesley Rosa <[email protected]> Co-authored-by: Malith Senaweera <[email protected]>
1 parent e545176 commit b7e0cfc

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* Fix - Use the platform's payment method configuration id constant when rendering the Optimized Checkout
5757
* Dev - Add Klarna e2e tests
5858
* Update - Improve checks in voucher purchase flow
59+
* Fix - Fixes page crash when Klarna payment method is not supported in the merchant's country by returning an empty array instead of throwing an error
5960

6061
= 9.5.2 - 2025-05-22 =
6162
* Add - Implement custom database cache for persistent caching with in-memory optimization.

client/utils/use-payment-method-currencies.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,13 @@ const getKlarnaCurrencies = () => {
212212
return [ 'EUR', 'SEK', 'PLN', 'CHF', 'CZK', 'DKK', 'GBP', 'NOK' ];
213213
}
214214

215-
// Throw an error if the country is not recognized.
216-
throw new Error(
217-
`Unable to determine Klarna currencies for: ${ accountCountry }`
215+
// eslint-disable-next-line no-console
216+
console.error(
217+
'Unable to determine Klarna currencies for:',
218+
accountCountry
218219
);
220+
221+
return [];
219222
};
220223

221224
const getAmazonPayCurrencies = () => {

readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ If you get stuck, you can ask for help in the [Plugin Forum](https://wordpress.o
154154
* Dev - Add Klarna e2e tests
155155
* Tweak - Update deprecation notice message to specify that legacy checkout experience has been deprecated since version 9.6.0
156156
* Update - Remove legacy checkout checkbox from settings
157+
* Fix - Fixes page crash when Klarna payment method is not supported in the merchant's country by returning an empty array instead of throwing an error
157158
* Fix - Fix payment processing for $0 subscription with recurring coupon
158159
* Dev - Add e2e tests to cover Affirm purchase flow
159160

0 commit comments

Comments
 (0)