Home›Support›English Support›[Resolved] WooCommerce Coupons have stopped working in secondary language (worked fine previously)
[Resolved] WooCommerce Coupons have stopped working in secondary language (worked fine previously)
This thread is resolved. Here is a description of the problem and solution.
Problem: The client reported that a coupon was functioning correctly in the primary language (English) but not in the secondary language (German). This issue was due to the add-to-cart URLs not being translated to match the product variations in the secondary language. The Elementor Price Table widget used did not automatically present URLs for translation, which is necessary for proper functionality in a multilingual setup.
Solution: We recommended ensuring that the 'Make themes work multilingual' and 'Language filtering for AJAX operations' options were enabled under WPML >> Languages. The client was advised to manually translate the add-to-cart URLs to correspond with the translated product variations. This involved editing the page in the original language, switching to the secondary language, and setting the correct URLs for the buttons. Additionally, the client needed to register the Elementor Price Table element using a custom XML configuration to make the URLs translatable by WPML. Detailed steps for registering custom Elementor widgets for translation can be found here: https://wpml.org/documentation/support/multilingual-tools/registering-custom-elementor-widgets-for-translation/
If this solution does not resolve your issue, or if it seems outdated or irrelevant to your specific case, we 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 problems persist, please open a new support ticket at our 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.
We have recently discovered from a user, that a coupon provided by us wasn't working.
After some analysis I discovered it was working fine in our primary language (English), but not in our secondary language (German).
This was not the case in the past, our coupons have never presented this problem.
The post type "shop_coupon" is correctly set to the recommended setting of "Not Translatable" (screenshot)
Please advise what has changed and how we can get our coupons working again in the secondary language.
WooCommerce Multilingual & Multicurrency is active on our site, if that's relevant. According to its status page everything looks good (green ticks everywhere, see screenshot).
Symptoms:
Coupons are only working in the primary language and have stopped working in the secondary language.
Questions:
Why are WooCommerce Coupons not working in the secondary language?
How can I fix the issue with coupons not working in both languages?
Also: WPML SEO not appearing as update, even after refreshing via Add New Plugin > Commercial, as mentioned further in this wizard.
I downloaded and installed the latest version of WPML SEO and cleared the WP Rocket Cache, but that didn't solve the issue either.
Also attached are the two screenshots, showing the coupon being applied successfully in our pimary language English and NOT being applied correctly in German.
The English subscription product (ID 15063) has the variations: #44032, 15064, #15065, #15066.
The German subscription product (ID 15067) has the variations: #44034, #15068, #15069, #15070.
However, when going through the add-to-cart process on both the English and German versions of our site, the system is only adding the English product IDs to the cart — even on the German pages.
Because of how WPML handles multilingual product contexts, this mismatch between the selected site language (German) and the actual product IDs in the cart (English) means the coupon is not being applied correctly.
This appears to be a WPML configuration or compatibility issue, so the best next step is to contact WPML support with these findings. They’ll be able to help adjust your product and variation mapping so that the correct language product IDs are added to the cart, which should resolve the coupon issue.
Welcome to the WPML support forum. Before passing this thread to my colleague, I would like to share some suggestions and possible solutions for the issues you mentioned. Sorry for the late response becuase of the holidays.
This may be a compatibility issue. Please visit the WPML >> Languages page and ensure the following options are enabled.
a) Make themes work multilingual >> Adjust IDs for multilingual functionality
b) Language filtering for AJAX operations >> Store a language cookie to support language filtering for AJAX
If it is already enabled, please follow the WPML and WooCommerce Multilingual troubleshooting steps in the linked article after taking a full site backup. Then, clear all caches (plugin, server/hosting, CDN, and browser) and check whether the bug still occurs.
I have checked both those options were enabled and cleared all caches etc, the result is the same.
Question:
Perhaps you could explain what I SHOULD be seeing? ... Are WooCommerce add-to-cart URLs supposed to have their translated Product IDs included in the TRANSLATIONS? I understood up til now WPML "translated" these on-the-fly (meaning it picked up the correct Product ID) depending on what language the user was using the site in.
So for example if add-to-cart=44032 is the English version, then add-to-cart= 44034 should be "found" automatically when using the German version of our site.
Could the problem be to do with the fact that when we translate the original page hidden link
to the German page
hidden link
that we are not even being offered the URLs from the Subscribe buttons to translate?! I seem to remember when I developed those pages originally years back that I was given the URLs to translate, however I could be mistaken.
1) From what you are saying, I am understanding that we MUST translate the add-to-cart URLs? In other words I MUST translate
hidden link
to its German equivalent of
hidden link
Correct? Has this changed at some point? We didn't have to do this in the past I believe.
2) That table you can see when opening the URL you are quoting is only for the mobile version of our Subscription selection page, because it's a simple HTML table.
For all non-mobile versions of that page, the buttons (which contain the add-to-cart URLs are from the Elementor Price Table and the URLs are not being presented for translation.
Can you please confirm if there was a change or not, as per my previous question? Up until now, I was of the impression that WPML "converted" these add-to-cart URLs by itself automatically depending on the language the user was using the site on.
WPML translates the URLs automatically if they are internal and are registered as URLs correctly. Before I create a copy of the site and escalate this ticket, I kindly ask you to try one last step:
- Go to WPML -> Settings -> Translate Link Targets -> Click on 'Scan now and adjust links' button -> Wait for the process to finish and double-check if the URLs are now fixed.
Can you tell me the results of the steps described above?
The process takes a long time and there are several thousand links in dev apparently. (see screenshot) On Production that would be much worse.
I have never truly understood, when it is appropriate to use this button and what it is actually doing in the background.
1) Is there any good documentation available about its purpose?
2) And when should I press it normally?
3) I have to keep that tab open, right?
In the past, I remember it used to just get stuck at a certain number, but I'll keep it running for now and see how it goes.