Home›Support›English Support›[Resolved] YayMail Conditional Logic doesn't show product categories in translated language
[Resolved] YayMail Conditional Logic doesn't show product categories in translated language
This thread is resolved. Here is a description of the problem and solution.
Problem: You are using YayMail Commerce with the YayMail Conditional Logic addon. While it works correctly in English, the addon does not display product categories in Italian, preventing the conditional logic from triggering. This issue occurs when you switch to Italian to style the mail; the categories listed in the conditional logic remain in English. Additionally, when setting the conditional logic to Product instead of Category, products related to one category are listed twice, indicating that Conditional Logic sees both the English and Italian product versions. Solution: We recommend trying the following workaround: In your WordPress installation, navigate to
// WPML Workaround for compsupp-7838
if (class_exists('Sitepress')) {
do_action('wpml_switch_language', $active_language);
}
This code snippet ensures that the language context switches to the active language, potentially resolving the issue with category and product translations.
Please note that the free version of YayMail is not compatible with WPML. If this solution does not resolve your issue or seems outdated, 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 the problem persists, please open a new support ticket.
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.
Background of the issue:
I am using YayMail Commerce, and it works correctly in both English and Italian. I installed YayMail Conditional Logic to show a specific text in the completed order mail. It works correctly in English, but in Italian, the addon doesn't propose the product categories in the Italian language, so the conditional logic is not triggered. I checked with Products instead of Product Category. For one group of products under a certain category (I work with 3 categories), I can see, in the Italian interface of the Conditional Logic plugin, both products in English and Italian, but not for the products of the other categories. I attach here the debug information.
The strange thing is that it does work with a test email (by clicking on "send test email" in YayMail)
Symptoms:
YayMail Conditional Logic doesn't show product categories in the translated Italian language, preventing the conditional logic from being triggered.
Questions:
How can I solve the issue with product categories not appearing in the Italian language in YayMail Conditional Logic?
Hi Drazen, thank you very much. I created three products in your sandbox with 3 different categories. YayMAil is set for the "Completed order" option.
The main problem is that when I switch to Italian to style the mail, the categories listed in the conditional logic are still English category (see image 1 attached). So if I make a order in the Italian version, the text is not triggered as Yay doesn't find in the order the English category, but the Italian one. I was not able to test it completely as the sandbox doesn't send emails (at least I didn't receive anything when trying a purchase).
On my website I tried to switch to Product, instead of Category, when setting the conditional logic. A even stranger thing happens: the products related to one category are listed two times, suggesting that Conditional Logic sees both the English and Italian product. The products related to other categories do not (see images attached 2 to 4)
Thank you very much. Now it works perfectly. However a question. Isn't a way to add the snippet to the file functions.php of my child theme? Otherwise, everytime I update the plugin I have to rewrite the Settings.php file
That is expected, it is a workaround, and we will update YayMail and you can also share this with the plugin author, so they can apply a permanent fix in the next versions.