Skip to content Skip to sidebar

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

Problem:
If you're experiencing issues with menus not being translated despite having full translations set up, and after enabling "adjust IDs for multilanguage compatibility", you find that getting the master ID of a product doesn't work, and links of translated products lead to a "too many redirections" loop.
Solution:
1. Change the permalink for the product base to the default one, which should display the products correctly in the secondary language.
2. Check the string translation for errors. The translation for links should only include the path, not the full URL.
3. If you're using Rank Math SEO, there might be a known compatibility issue causing the redirection problem. Please refer to the errata page for more details.
To resolve this, make a full backup of your site and then add the following code to your theme's functions.php file:

/* Filter to disable custom product redirection. */<br />add_filter( 'rank_math/woocommerce/product_redirection', '__return_false' );

If this solution doesn't look relevant to your issue, please open a new support ticket with us.

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 jariA-3 1 year, 12 months ago.

Assisted by: Ilyes.

Author Posts
January 10, 2024 at 9:14 pm

jariA-3

This past week I was having a problem with menu's not getting translated into different languages although they did have full translations set up. In the end the supported fixed this by enabling "adjust ID's for multilanguage compatablility". Now however, getting the master ID product a product ID doens't work anymore, also, links of translated products don't work anymore, they end up in a "too many redirections" loop

January 10, 2024 at 10:17 pm #15171806

Ilyes
Supporter

Languages: English (English ) French (Français ) Arabic (العربية )

Timezone: Pacific/Easter (GMT-05:00)

I got the following error when saving your backup, it couldn't write in the destination folder :

Unable to write to /var/www/big-in-fabric.com/wp-content/plugins/all-in-one-wp-
migration/storage/error.log.

hidden link

I will install Duplicator instead, it might work with it,

I will let you know once done,

January 11, 2024 at 9:33 am #15173157

jariA-3

Oke, let me know if that works, I can give the site access to write to that folder if needed, so you could use WP- all in one migration

January 11, 2024 at 12:46 pm #15174542

Ilyes
Supporter

Languages: English (English ) French (Français ) Arabic (العربية )

Timezone: Pacific/Easter (GMT-05:00)

Hey again,

Even duplicator didn't work for me (locally), could you please give us access to write in that folder or simply save a backup (without media folder) with WP all in one migration, I can then download it,

Thank you!

January 11, 2024 at 1:50 pm #15174905

jariA-3

Hi,

I hope I understood what you meant, you couldn't create / download a backup from duplicator? or you couldn't get the wp installation to work locally? I checked and zipped this duplicator pro backup, you should be able to download it from here:

hidden link

if that doesn't work this one should:
hidden link

January 11, 2024 at 2:22 pm #15175057

Ilyes
Supporter

Languages: English (English ) French (Français ) Arabic (العربية )

Timezone: Pacific/Easter (GMT-05:00)

So here are my findings so far :

1- When you change the permalink for the product base to the default one, the products will show correctly in French :

- hidden link

2- The link that it redirects to seems to be related to a wrong translation of your links, for example I found this in string translation :

- hidden link

The translation for that string shouldn't be the full link, but only the link part "/frequently-asked-questions/" , this is not the concerned string as I'm still trying to find which link is not correctly translated because your Woocommerce URLs seems to be trnaslated correctly

3- After digging around, I found out that this might be related to a known compatibility issue with Rank math SEO : https://wpml.org/errata/rank-math-seo-err_too_many_redirects-error-on-woocommerce-products/

- Make a full backup of your site before proceeding.
- Add this code into your theme’s functions.php file:

/* Filter to disable custom product redirection. */
add_filter( 'rank_math/woocommerce/product_redirection', '__return_false' );

Best,

January 11, 2024 at 3:10 pm #15175409

jariA-3

Hi,

Great! That does seem to fix the problem for the French products 🙂 is there a way to remove the url's from the string translations? Not sure how that happend.

Gr,
Bram

January 11, 2024 at 3:29 pm #15175574

jariA-3

Also I was wondering if you can help with this,

If I'm correct, then the duplicate products don't get all properties of the original copied, so for instance not all meta data. So I want to get the original product ID and do checks on that product. I should be able to to do the following in my functions.php yet, it consistantly doesn't work.

[PHP in functions.php within a loop using global $product]

echo "Duplicate ID: ";
echo $dupID = $product->get_id() . "<br>";

echo "Original ID: ";
// this doens't output anything
echo $translations = apply_filters( 'wpml_master_post_from_duplicate', intval($dupID));

Any idea why? It's really handy to be able to get the ID's of the original products.

Screenshot 2024-01-11 at 16.28.14.png
January 11, 2024 at 3:57 pm #15175767

Ilyes
Supporter

Languages: English (English ) French (Français ) Arabic (العربية )

Timezone: Pacific/Easter (GMT-05:00)

Hey Bram,

I have corrected those strings for you, no need to delete anything,,

Have a good one!

January 12, 2024 at 9:14 am #15177913

jariA-3

Great!

Thanks for your help! Much appreciated! 🙂 I'm going to continue working on the site of the site, hopefully all will work as expected now. If I find another problem, you'll probably hear back from me O:)

Thanks again 🙂

P.S. You can ignore my post #15175574 naturally that won't work if I insert " <br>" into the ID string :p However I couldn't get "wpml_master_post_from_duplicate" to work, not even if called as intended. But $master = apply_filters( 'wpml_object_id', $product->get_id(), 'product', true, 'nl'); does get the master ID, so I'll just use that 🙂