Change Language Displayed in Klarna Payments

  1. Home
  2. /
  3. Klarna for WooCommerce
  4. /
  5. Customization
  6. /
  7. Change Language Displayed in Klarna Payments

Change Language Displayed in Klarna Payments

In general the language of the checkout is determined by the locale of your WordPress installation.


How Klarna determines the language


The language displayed in the Klarna Payments iframe is based on two factors:

  1. The country selected by the customer in the checkout.
  1. The WordPress locale (get_locale()).
    Klarna attempts to match a supported language for the selected checkout country. If the WordPress locale is not a valid option for that country, Klarna will default to a supported language instead.

Overriding the default language


To override the WordPress locale, use the kp_locale filter to force a specific locale.

Example: Force French in Canada

Klarna supports French (fr-CA) in Canada. To force Klarna Payments to display French, regardless of the WordPress locale, use the following snippet:

/* Force French (Canada) locale for canadian customers */
add_filter( 'kp_locale', 'kp_force_canadian_locale');
function kp_force_canadian_locale( $locale ) {
	// Get the customers country from the checkout.
	$country = WC()->checkout()->get_value( 'billing_country' );

	// If the country is CA, set the locale to fr-ca.
	if( $country == 'CA' ) {
		$locale = 'fr-CA';
	}

	return $locale;
}

Klarna will display the checkout in French because French is a supported language for Canada.


Supported language-country combinations


Klarna does not support all possible combinations of languages, countries, and currencies. If an unsupported locale is set, Klarna will automatically select a valid alternative.

For a full list of supported locales per country, refer to Klarna’s documentation: Data Mapping – Klarna Supported Countries, Currencies, and Locales.

Example: Why de-CA (German in Canada) wouldn’t work

Klarna only supports certain language-country combinations. Canada only supports English (en-CA) and French (fr-CA) in Klarna Payments. German (de-CA) is not a supported language for Canada.

If you try to force de-CA using the kp_locale filter, Klarna will ignore this setting and default to a valid alternative (likely English or French). Klarna does this because it verifies the locale against its list of supported languages per country before displaying the checkout.