Skip Navigation

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.

This topic contains 9 replies, has 2 voices.

Last updated by Marti 11 months, 3 weeks ago.

Assigned support staff: Carlos Rojas.

Author Posts
May 12, 2020 at 3:41 pm #6114621

Marti

Hi,

I have an issue with "WooCommerce Conditional Shipping and Payments" plugin, which I rely on to restrict payment gateways to specific product categories.

Problem: restriction rules only work on main language (EN), and not on secondary language (FR).

I set rules in WC > Settings > Restrictions > Payment Gateways. Here I add categories and save.
If I switch to secondary language (FR) I can see that categories are missing. If I add them in FR as well, a while later (cron?) the categories in FR are still missing.

There is a similar topic here for which you provided a fix snippet, unfortunately this only concerns shipping rules.

https://wpml.org/forums/topic/conditional-shipping-and-payments-does-not-seem-to-be-compatible-with-wpml/page/2/

If one of your wizards could come up with a similar fix for payment gateways that would save me!!

Thank you!

Martin

Capture d’écran 2020-05-12 à 17.39.19.png
May 17, 2020 at 6:02 pm #6152579

Marti

Why would the robot close the ticket if you didn’t reply?! Bad bot 🙂

May 18, 2020 at 9:46 am #6156527

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi Martin,

Please let me know when you reproduce the issue on the test site I shared in my previous (private) message 🙂

Regards,
Carlos

May 21, 2020 at 2:51 pm #6187541

Marti

Hi Carlos,

I've setup the test site with only WC, WC Conditional Shipping & Payments, created product categories and products.

Here is a screen recording where we can clearly see the issue:
hidden link

You can see I:
1. setup restrictions in EN, adding categories there and save. Restriction works ok in EN front-end.

2. I move to French restrictions (where categories are missing, and thus restrictions not working on FR front-end).
I add categories inside french restrictions and save. They now work ok in FR front-end).

3. After saving in FR, the EN categories in restrictions go missing again, and thus restrictions are not working on EN front-end..

Like I said I believe this is the same problem than this topic (only with Payment restrictions instead of Shipping).
https://wpml.org/forums/topic/conditional-shipping-and-payments-does-not-seem-to-be-compatible-with-wpml/page/2/

Thanks for your help!

Cheers!

May 22, 2020 at 10:03 am #6194201

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,
Thank you very much for sharing the video and reproducing the issue on the new site.

I have followed these steps:
- I went to WPML -> Settings -> Custom XML Configuration and added the following code:

<wpml-config>
    <admin-texts>
        <key name="wccsp_restrictions_global_settings">
            <key name="*" /></key>
    </admin-texts>
</wpml-config>

- Now I can go to WPML -> String Translation and translate the ID of the categories under 'admin_texts_wccsp_restrictions_global_settings' domain. I also kept the conditions 'in' and 'category_in_cart' as a translation just to avoid any conflict there.

I kindly ask you to check if the issue persists on the front-end after the steps above and if the issue persists, then describe the steps to reproduce it or just shared a screencast as you did in your previous message.

Note: The categories still disappear in the other language after saving, but I think this is just an interface issue because the values are already translated in the database. In any case, I think we are getting closer to a solution 🙂

Looking forward to your message.
Regards,
Carlos

May 22, 2020 at 1:08 pm #6195795

Marti

Hi Carlos,

Thanks for quick reply,

1. Current setup not working.
I went back to the test site, and it turns out the categories in EN restrictions are not showing, they show up in FR. So I guessed you last edited them in FR version.
The problem is that on front-end, restrictions are not working in EN, but neither in FR. So problem seems even worse :p

2. String translations
Sorry i'm a bit confused as what you translated in string translations. What do you mean by "translate the ID of the categories under 'admin_texts_wccsp_restrictions_global_settings' domain"?
I went to string translation for this domain, but I only see FR IDs in source language (27 and 24) and their translation (25 and 24) which are EN IDs. Things seem reversed here.

The 2 product categories have these ID: 24 and 25 in EN, and respectively 26 and 27 in FR.

Can you check.

Thank you!

Martin

May 25, 2020 at 10:50 am #6209355

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi Martin,

I double-checked the restrictions and re-save them this time in English, then I went to WPML -> String Translation and translate the IDs of the categories as well as the other strings (just as a precaution).

Could you check if the issue still persists on the test site?

Regards,
Carlos

June 1, 2020 at 9:15 am #6264279

Marti

Hi Carlos,

this seems to work!

Just to be sure, can you detail what you did when "translating category IDs"?
- Which value did you put and why?
- Can you confirm this is a good practice and won't break anything on my live setup?

I have many WC plugins working fine multilingual, I want to be sure translating category IDs is ok..

Thank you!

June 1, 2020 at 12:03 pm #6265111

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

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

Hi,

When we talk about 'translating IDs' is basically searching for the ID of the category in WPML -> String Translation and add the ID of the equivalent category for the secondary language. You can find the IDs of the categories while editing them.

In this case, the plugin saves the IDs of the categories to apply the conditions, and the logic applied was to provide the IDs of the categories in the secondary language to the 'translation' of these values. This way the plugin will get the values of the IDs of the categories in the second language when applying the conditions in that language 🙂

These steps won't affect any other functionality on the site and it's widely used on different plugins and themes to provide the correct IDs depending on the language.

Best regards,
Carlos

June 22, 2020 at 1:24 pm #6426901

Marti

Hi Carlos,

Sorry I didn't get back to you on this.

Your workaround works great! Not ideal since I have to get there every time I update or change a rule, but it works!

Thank you so much for your time and great support!

Cheers,

Martin