Wrong language for Klarna
-
Hi
I use WPML on my websites, when I choose Klarna, it always open the page in German, I don’t understand
https://ibb.co/vsSBSNh
https://ibb.co/2tb3ty8Thanks for your help !
-
Hi @calyweb
On the Advanced Settings page of the Stripe plugin are you using the Site Locale value for the
Locale Typeoption?When Site Locale is selected, the plugin will use the locale of the WordPress website.
Kind Regards
Hi,
Yes i tried both options, Site locale, or auto, it does not change anything, i always have Klarna in german when it opens their website
Yes sure you can test it here : https://www.gladiatorfit.ch/
Hi @calyweb
I see right now you have the Locale option set to
auto. This is a configuration object take from your checkout page:{
"paymentMethodTypes": [
"klarna"
],
"locale": "auto",
"mode": "payment",
"paymentMethodCreation": "manual"
}Klarna is rendering in English when I tested and I am based in the United States.
Kind Regards
I changed to Site locale, can you check again ?
I’m in France, French browser and language, and always the new page in German
Hi @calyweb
Here is a screenshot showing Klarna rendered in French.
I do see when the user is redirected to the Klarna payment page that the language is in German. That is because the language shown on the Klarna payment page is based on the billing address provided by the customer on the checkout page. Since your address options are Germany or Switzerland, it chooses German.
You can override that behavior using a filter in the plugin. Let me know and I will show you what to do to force French.
Kind Regards
Hi,
Yes if you can it’s better because in switzerland we have 4 different languages … It’s a weird setting to check the language by address ^^ Why don’t just check the locale ?
Thanks for your help for the hook
Hi @calyweb
It’s a weird setting to check the language by address ^^ Why don’t just check the locale ?
I don’t think it’s weird. If a customer is providing a billing address country then presumably they speak the default language of that country. It was a decision made to ensure the language presented was one the customer spoke.
The site locale is another good option as well which we may default to in the future. That’s why we provide filters, so merchants can go beyond what the plugin can offer in the way of settings.
Here is an example of how you can customize the language of the Klarna payment page:
add_filter('wc_stripe_payment_intent_args', function($args, $order){
if($order->get_payment_method() === 'stripe_klarna'){
$args['payment_method_options']['klarna']['preferred_locale'] = 'fr-CH';
}
return $args;
}, 10, 2);I recommend using a code snippet plugin to add this to your site.
Kind Regards
Hi,
I wrote this but it does not change anything :
// METTRE KLARNA EN FRANCAIS
add_filter(‘wc_stripe_payment_intent_args’,function($args, $order){
if($order->get_payment_method() === ‘stripe_klarna’){
$args[‘payment_method_options’][‘klarna’][‘preferred_locale’] = ‘fr-CH’;
}
return $args;},
10, 2);Thanks !
Hi @calyweb
I tested this code and it works. I confirmed the locale was sent to Stripe in the payment intent request. Whether Klarna correctly renders the preferred locale is another story and we can’t control that from the plugin. The Stripe API provides the preferred locale option but Klarna can still override that based on their internal logic.
You can confirm the locale is sent by going to the stripe.com > developers > logs page. Here is a screenshot showing the payment intent that was created in my test.
Kind Regards
I have well that too on stripe
And always in French on the checkout on our website, but as soon as we click on Validate Checkout and it opens the Klarna page, always in German
Hi @calyweb
I would recommend you contact the Stripe support team and show them this support thread so they can see the correct properties are being sent to their API. It seems Klarna is ignoring that property and choosing German based on some internal setting or override.
Kind Regards
The topic ‘Wrong language for Klarna’ is closed to new replies.