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.
Please follow these steps and let me know the results:
- Edit the page in the original language
- Switch to the secondary language using the language switcher that appears in the admin bar (top)
- Click on the option to 'edit anyway' that will appear in a pop-up window
- Set the correct URL for the first button
- Save the changes
- Check if the issue disappears for that button in the frontend in the secondary language
Can you tell me the results of the steps described above?
That workaround works, and the correct add-to-cart URL is used in German for all buttons (I changed all of them).
For the mobile version, the HTML version already contained the correct versions.
However this is only a workaround, since if I make further edits to those translations in the future using the standard translation procedure (see screenshots from WPML/Elementor), the German edits which were saved will be lost again. WPML should be able to translate these URLs automatically or at least present them in the translation screen for manually entry/translation.
The two checkout/coupon screenshots are once from adding the product with the mobile version of the site, and once from a desktop browser.
What exactly, should I be checking for? I don't see any difference and the URLs are still not presented for translation for non-mobile versions (those coming from the Elementor Price Table widget) ...
Now you can see and translate the URLs when translating the page.
Please edit the page in the original language -> Add a slash and the end or remove the last slash of the URLs in the buttons -> Save the changes and update the translation. Now you should see the option to translate the URLs.
OK, now I can see the URLs available to translate as expected ... but how did you get that to appear? By adding or removing a slash at the end of the URL?
What is the "correct" (or expected) definition of the URL? With of without a slash at the end?
Because I will have to fix this on our production site too...
1) Edited the button and added and removed the slashes.
2) Published in Elementor.
3) Tried to translate it: no changes, no URLs presented to translate.
Then I tried:
4) Edited buttons and added a slash on all of them. Then published.
5) Then edited the buttons again and removed all the slashes and re-published.
6) Tried to translate it: no changes, no URLs presented to translate.
I cannot seem to "force" an update on Production to make WPML realise there was some change... All of these "workarounds" still seem a bit clunky to me. It still feels like I'm trying to "trick" WPML into doing something it should be capable of already.
2.- The URL can have a slash or not at the end, that makes no difference at all, however, adding/removing the last slash and then re-saving the page forces the WordPress core to refresh the entry in the database for that page which let WPML knows there is a change and allows it to 'pick up' the URL fields already defined in the previous step.
To solve the problem in the production site you must copy/paste the XML code from the dev site in WPML -> Settings -> Custom XML Configuration tab to the same place in the production site. Then edit the page, edit the URLs (add/remove the last slash), save the changes and update the translation.
Has something changed with the WPML Plugin to make this procedure become necessary? It should not be necessary for standard Elementor or Elementor Pro widgets in my opinion.
Furthermore, the Custom XML provided, while it works, is only masking the core bug in WPML which is preventing it from not making the URLs visible using standard translation procedures.
Can you please give me an idea of when is WPML planning to fix this issue permanently so i can remove the custom XML from our website?
The Elementor shortcodes register by WPML are listed here: hidden link and the 'price-table' element is not listed. That is the reason why I had to register the element on your site.
I'd recommend that you contact the Elementor support service and ask them to create the wpml-config.xml file to register all the elements missing.
Just to know for future reference then: did you download that Multilingual Tool as a plugin and then delete the plugin on our dev site? I don't see that plugin listed in our list of installed plugins?