Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client is experiencing issues with the Affirm payment gateway on their bilingual English and French Canadian WooCommerce site. When trying to checkout in French, the Affirm checkout flows remain in English. The client suspects this might be due to the default locale values being set to "en_US" and "fr_FR" instead of "fr_CA" for the Canadian locale.

Solution:
We confirmed that default locales are editable and that the client correctly changed the locale to "fr_CA". However, changing the locale can cause issues with WooCommerce translations because they are tied to the default locale. To address this, the client can either translate the missing strings themselves or install the French Canadian language pack. For the Affirm issue, we suggested checking if the Affirm WooCommerce plugin integration can be translated via String Translation. Additionally, we pointed out that the Affirm documentation requires adding a script with specific locale and country code parameters. Since WPML requires two locales for bilingual sites, the client might need to load a different script for French pages. We acknowledged that this is a complex issue that may require the cooperation of the Affirm author and suggested that the client contact one of our contractors for further assistance.

Please note that this solution might be irrelevant due to being outdated or not applicable to your case. If so, we recommend opening a new support ticket. We also highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If you need further assistance, please contact us on the WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 4 replies, has 2 voices.

Last updated by Laura 1 year, 2 months ago.

Assisted by: Laura.

Author Posts
February 1, 2024 at 7:31 pm #15256765

Kader

Here is a quick video summary of the issue: hidden link

Currently our website has 2 languages, English and French. I am trying to integrate the plugin "Affirm" gateway as a payment option for woocommerce and am running into some issues with the French implementation, specifically the problem is when trying to checkout on the French site using Affirm, the Affirm checkout flows remain in english.

I have contacted Affirm support and so far they have not been able to help and are asking I get in touch with WPML. I have tried a few different things on my side as well but no luck so far.

I did notice something in the Affirm documentation which mention they only support specifically these languages for CAN locale : en_CA and fr_CA hidden link

In the WPML languages settings I can see that our website's 2 languages seem to have been configured using "default locale" values set as "en_US" and "fr_FR" (perhaps these were default values when adding english and french language), so I suspect that the issue I am running into with Affirm MIGHT be due to this. Therefore, I tried to modify the default locale value in WPML for french to fr_CA however, when I change the value of the french language from "fr_FR" to "fr_CA" I notice 2 things:
1. Some of the french translations on the website remain while others revert back to english, for example most texts in the woocommerce cart/checkout pages revert to english while on the french website.
2. Secondly, even though I changed the "default locale" to fr_CA, this did not change the language of the Affirm checkout flow...

I am wondering if possibly changing the "default locale" to "fr_CA" doesnt work correctly or isnt properly applied when modifying an existing language default locale value and this would explain why #1 and #2 happen. Are these "default locale" values intended to be editable (it seems like it since its possible to edit them) and if not, how can we convert the languages currently setup from "fr_FR" to "fr_CA" in order to solve the french affirm issue (or at the very least, eliminate this has a potential cause).

Note: The website hidden link is a temporary staging environment where we can do tests. Here are the user and passwords for both ACCESSING the website as a visitor and log inside wordpress admin (same user/pass) [removed]

Thank you,
Louno

affirm-01-french-product-page.png
affirm-02-french-cart-page.png
affirm-03-french-checkout-page.png
affirm-04-wpml-language-default-localpng.png
February 2, 2024 at 7:14 pm #15261008

Laura
WPML Supporter since 05/2018

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

Hi,

thanks for contacting us.

Please do not leave credentials outside the private box, the forum is public and we can't use them anyway due to GDPR.

First of all I would encourage you to update WooCommerce Multilingual since the version is very old and it might not work well with the current WPML version.

About default locales: yes, they're editable in the Language table and you edited them correctly - it also makes sense to change them if you're located in Canada and want to reach a Canadian audience.
The reason why you don't see WooCommerce translation anymore it's because WooCommerce is already localized in several languages including French, so you were loading the .po file for French.
However, such files are tied to default locale, and your file was very likely the fr_FR one. If you change the locale, the file can't be loaded anymore.
You have 2 solution at this point:
1. translate the missing strings yourself
2. install the French Canadian language pack - see here hidden link

I hope my explanation is clear.

However, I checked the documentation from Affirm and just changing the locale won't solve the issue.
I see there is a WooCommerce plugin integration, did you check if you can translate it via String Translation? https://wpml.org/documentation/getting-started-guide/string-translation/finding-strings-that-dont-appear-on-the-string-translation-page/

February 2, 2024 at 9:01 pm #15261194

Kader

Hi thanks for the reply.

Ok so changing the fr_FR default locale to fr_CA is possible and I understand that I might need to import language pack or translate the missing strings. That is fine.

That being said, the real bigger issue is getting Affirm to work in French. I have changed the default locale to fr_CA on the staging site and this doesnt make Affirm display in french. You said that "just changing the default locale wont solve the issue" but I do not understand why you say this?

Essentially, that is specifically the requirement that Affirm needs. The affirm checkout flow will be displayed based on what the default locale of the page is, either en_CA or fr_CA ... this checkout flow is NOT hosted locally, its on the Affirm server, we just need to pass the variables, if Affirm doesnt detect one of these default locale then it uses the default which is en_CA.

This means, there are no string to translate because essentially this is pulled directly from Affirm servers... the Affirm server checks if the page is fr_CA and if so it should display in french but that is not the case.

In order to eliminate all possible variable, I tried to setup on a completely different server a blank wordpress/wooocommerce test website which uses the latest version of the bare minimum plugins required to test this (woocommerce + affirm + wpml) and I get the exact same problem, affirm checkout doesnt display in french when the french default local is set to fr_CA. You can try it here, hidden link switch the site to french and add product to cart, then try to checkout with affirm you will get the affirm checkout in english.

Assuming that everything is configured correctly (it might not, but i think it is) then the conclusion is that either something is wrong with WPML or something is wrong with Affirm... however, I do see affirm working perfectly fine on many other french/english websites.

Note : Updating woocommerce on the original hidden link staging site currently is not an option because it requires upgrading php on my server and we cannot get into this right now as it will affect all the sites on the server and potentially require a lot of troubleshooting for all sites, this is why i setup that new server with clean wordpress install just to prove that updates arent the issue.

February 2, 2024 at 9:51 pm #15261386

Kader

Ok so after many hours of troubleshooting I think I have some important information...

Basically, in order to further eliminate ALL potential source of conflict, I have setup a new temporary clean wordpress installation here:
hidden link

I created the website FROM the start in FRENCH CANADIAN and there are NO other languages on the site. On this wordpress installation everything is up to date and I only have 2 plugins:
- Woocommerce
- WooCommerce Affirm Gateway
When you try to checkout the Affirm checkout flow works in FRENCH !!!

However, in order to test this further I made another identical copy of that test site here:
hidden link
The only difference with this copy is that I added 1 plugin, the WPML plugin in order to add ENGLISH language to the website. Now after adding English to the site if I try to checkout in ENGLISH, the Affirm checkout flow will only display in FRENCH. If I try to change the website default language to ENGLISH, then regardless of which language I am browsing the website in the Affirm checkout flow will be in ENGLISH.

The conclusion is clear, whatever is set as the default language in WPML will force the Affirm checkout flow in that language.

I am not sure if the root cause of this issue is with Affirm or with WPML (I am sure you will each try to blame the other one) ... But this is clearly a bug. I would really appreciate if we could find a solution quickly to this issue, or perhaps a workaround.

February 5, 2024 at 1:05 pm #15266214

Laura
WPML Supporter since 05/2018

Languages: English (English ) Italian (Italiano )

Timezone: Europe/Rome (GMT+02:00)

If you check the Affirm documentation it says you need to add a script which says among other things

_affirm_config = {
		public_api_key: "{YOUR_PUBLIC_API_KEY}",
		script: "<em><u>hidden link</u></em>",
		locale: "fr_CA",
		country_code: "CAN",
	};

The plugin likely adds this script ot the site, and makes the script match with the site's default language. That's why it doesn't work, with WPML you'd need to add TWO locales, not one. Or load a different script when you load pages in French.

Therefore I'm not surprised to hear about your testing, it confirms what I just said.

Unfortunately there's not much we can do here. Affirm Payments is used only by very few of our clients and we'd need the author's cooperation to make it work. I can only suggest you contact one of our contractors and see if they can help you solve this https://wpml.org/contractors/