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.
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
|---|---|---|---|---|---|---|
| - | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 | 9:00 – 18:00 | - |
| - | - | - | - | - | - | - |
Supporter timezone: Asia/Karachi (GMT+05:00)
Related documentation:
This topic contains 0 reply, has 0 voices.
Last updated by Miro 1 year, 1 month ago.
Assisted by: Waqas Bin Hasan.
| Author | Posts |
|---|---|
| January 6, 2025 at 8:29 am #16565269 | |
|
deborahv |
Background of the issue: Symptoms: What is odd, is that when hovering the language switcher from the Dutch single-product-page to access the page in English or German, the URL slug is false. It shows the category slug in the default language, not the translated slug. But, when accessing the product category page, for example in German language, and hovering on a product, it shows the correct slug. In both instances, when clicking on the product it causes the ERR_TOO_MANY_REDIRECTS error. I added a screencast of the issue. For example, the dutch category is called Perfect Binder, the German category is called Klebebinder. When clicking on a Dutch product, it shows without issue. When clicking on the translated product, the url slug is automatically shown with the Dutch slug hidden link, instead of the German slug hidden link.../klebebinder/...../ Questions: I opened a case end of December, one Supporter recommended to check if the Taxonomy-slug is translated (Yes, this was done years prior to this issue) so this unfortunately did not help. |
| January 6, 2025 at 9:09 am #16565390 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi, Reference to our recent chat, I'll need access to a staging site for further debugging. Your next answer will be private, to share this information safely. IMPORTANT: Please keep a complete backup of the staging site also. I may need to activate/deactivate plugins and at times we may need to restore the staging site as well. See https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/ for details on privacy and security. P.S.: If you don't see the section for providing access information, do not write in the message box or the information may appear as public. Regards. |
| January 6, 2025 at 10:45 am #16566032 | |
|
deborahv |
Hi Waqas, I have made some test in the staging website: - switched to a basic theme Twenty Twenty-Five (As all of these are needed to view my webshop in 3 different languages) The problem stays exactly the same. This would mean the issue is most likely within WPML or WooCommerce, or in the settings of my WPML installation, correct? Hope this helps. I look forward to your feedback once you've had a moment to look into it. |
| January 7, 2025 at 6:26 am #16568042 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates, I am working on this and 'll get back to you as soon as I find something or have a solution. |
| January 7, 2025 at 8:39 am #16568451 | |
|
deborahv |
Thank you, I look forward to your update. |
| January 7, 2025 at 1:33 pm #16569709 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I tried some tests but I need more time to investigate it more detail. I'll get back to you by tomorrow accordingly. |
| January 8, 2025 at 10:10 am #16572739 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. I've checked several things in detail and apparently looks like there are duplicated slugs in products, posts, pages and categories which are creating this issue. In WP, every slug must be unique. However, I am trying to find out more about it. I've installed a file manager and a database manager plugin and investigating more. Please allow me some more time and I'll get back to you as soon as possible. |
| January 8, 2025 at 10:20 am #16572772 | |
|
deborahv |
Hi Waqas, Thank you for your reply, but I have to disagree on the statement of duplicated slugs, as this is not correct. For the translated products we use, yes, the same product name and slug. But before the update, each slug was unique. For translated products, we use the same product name and slug as base language, but the translated category and subcategory slug in the URL, thus creating an unique URL for each language. After the update, it redirects the translated product pages, somehow creates an URL with a category slug of the base language instead of the translated category slug, causing a redirect error. It is only an issue on the individual product pages for translated languages, the translated category pages are still visible and not redirected. If you need further details from me, or assistance, let me know as I'd be glad to help you out. |
| January 9, 2025 at 5:48 am #16575947 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates. I was able to reproduce the same issue in a fresh sandbox site and 've escalated the matter to our 2nd tier team. I'll update you accordingly. |
| January 9, 2025 at 11:46 am #16577439 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for your patience and cooperation. Our team investigated the issue and found that it is coming from WooCommerce due to some latest changes which may need to be catered accordingly. So our team has escalated the issue to our dev team for further processing. In the meanwhile, team suggests to add the following workaround to your theme's functions.php file:
add_filter( 'wc_product_post_type_link_product_cat', 'custom_modify_product_cat', 10, 3 );
function custom_modify_product_cat( $primary_term, $terms, $post ) {
// Example: Replace the primary term if the product has a specific category
if ( $post->post_type === 'product' ) {
foreach ( $terms as $term ) {
$termid = apply_filters( 'wpml_object_id', $term->term_id, $term->taxonomy, TRUE );
$term = get_term( $termid, $term->taxonomy );
return $term;
}
}
return $primary_term;
}
I've added this to currently active theme in your staging site and now translated product single pages seem to work fine. |
| January 10, 2025 at 10:19 am #16581304 | |
|
deborahv |
Hi Waqas, I added the code to my functions.php file, and now the translated product pages are accessible again! Many, many thanks for helping me out and finding a solution! At this moment there is a new update available for WooCommerce, but do you suggest I wait with updating, untill they've found a permanent solution? |
| January 10, 2025 at 11:35 am #16581824 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Thank you for the updates and glad that worked out for you. I had already tested with latest WC update which didn't fix this issue, so the fix our team provide 'll still be needed. The matter is with our dev team and it may take some time to roll out (and not sure either we'll fix it or WC does it). I recommend using the workaround until then. |
| April 15, 2025 at 9:51 pm #16936216 | |
|
Miro |
Hello all, and sorry for hijacking this thread, but we are facing exactly the same issue. Sadly, Waqas, your otherwise stellar solution works only technically for us - it DOES fix the wrong permalinks. So eg. if we had: siteurl.cz/product-category-main-language/product-1 it, before your fix, incorrectly pointed to: and errored out with "Too many redirects", instead of going to desired URL: This all worked correctly until recent WPML update. Your code solution DID fix the URL, so it now points correctly, eg: indeed changes correctly to: But... we still get the "Too many redirects" error! 🙂 And now the weird thing - if I translate the product (or just use "Duplicate" in Translation Management), the URL is suddenly correct (with or even WITHOUT your code fix), AND suddenly the "Too many redirects" error is gone and everything works. Sadly, this would mean duplicating 8300 products by hand, which takes a lot of time (even on very strong overkill VPS, doing batches of 100 products). I have tried debugging, tried solving this with AI, even wrote a script to Duplicate the products programatically, but it just ignores them, as if they were already translated. Would you please have any solution or directions for us? Thank you for your time and help! |
| April 16, 2025 at 5:38 am #16936648 | |
|
Waqas Bin Hasan WPML Supporter since 05/2014
Languages: English (English ) Timezone: Asia/Karachi (GMT+05:00) |
Hi @Miro-2, Thank you for contacting the support. I understand the problem but the issue reported in this ticket earlier, is being worked on by our dev team. Since applying the same workaround haven't fully fixed your issue, as well as, the new update, I'll recommend reporting in a new and separate ticket. So we can investigate, observe and provide a suitable solution. Please note that even issue looks the same but sometimes different sites may have different setup, configs and data. Regards. |
| April 20, 2025 at 9:25 pm #16950348 | |
|
Miro |
Hi, Waqas, thank you for your reply and willingness to help! You are right, each respective site´s config may vary. I will open a separate ticket, then. Also, I have discovered that duplicating the product via eg. Translation Management does the trick - it stops giving "Too Many Redirects". However, duplicating, in our case, almost 9000 products, even if in batches of 100 products (WPML/Translation Management lets me clone 100-200 products in one go - though the 200 is clunky to "checklist" and really does not save much time due to that). So if there would be some way to batch "duplicate" thousands of products, that would solve our issue as well. However, I have tried DIY scripts, DB queries, everything... and it seems WPML does not like that and simply refuses to clone the products programatically like that. But of course - I might simply be writing a wrong script. Regardless, thank you for your help, especially since I was cross-posting into old thread! Have a nice day and if you would have any more input, I am all ears, of course. |