Skip to content Skip to sidebar

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 5 replies, has 0 voices.

Last updated by Bobby 2 months, 1 week ago.

Assisted by: Bobby.

Author Posts
May 7, 2025 at 4:51 pm #17008012

Miro

ps: Bobby, I have some good news, it seems!

I have tried the proposed fix from the other thread:

add_filter( 'wc_product_post_type_link_product_cat', 'custom_modify_product_cat', 10, 3 );

function custom_modify_product_cat( $primary_term, $terms, $post ) {
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;
}

Last time, it DID NOT work. Now it seems it does!
I have tried some products BEFORE the fix: "Too many redirects."

Now the same products at first display the wrong URL, but it quickly switches, does not error out and immediately redirects to the correct URL and works!

Could you please confirm, too, via clicking about a dozen products (if you are able, also some older ones - they are chronologically listed and down on the page is pagination for this)?

Maybe it was the latest WPML/WooCo Multilingual update that caught up to this code snippet fix?

Whatever, if that is the case, I am happy beyond measure. 🙂

May 8, 2025 at 5:23 am #17009711

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

It looks like the issue you are experiencing is related to this Errata documentation.

https://wpml.org/errata/woocommerce-multilingual-too-many-redirects-error-when-using-shop-base-with-category-permalinks/

The fix for this will be released in the next WCML version, however, at the moment the workaround should help.

May 12, 2025 at 1:09 pm #17023167

Miro

Hi, Bobby,

sadly, we have discovered that SOME products still caused the too many redirects error. 🙁

Especially certain categories - unsure why. Everything is translated (slugs, categories etc.) properly.

However, I have tried changing permalinks to much simpler ones (basically "shop URL + /product/") and this "solution", I am almost afraid to confirm (so it does not backfire again 🙂)... DOES SEEM TO WORK.

We have not been able to find a product which does not work, but there are 9000 of them, so hopefully, the simpler permalinks resolved that.

However for most sites this would be unrealistic due to SEO reasons, so fingers crossed the fix in the next version gets implemented. ✌️

I guess we can close this ticket. For me, the most important thing is that the site works, but of course, at a price of different permalink structure, which might be unnacceptable for others.

All the same, thank you for your time and help with this, Bobby. You went out of your way to help us and I am so happy you did not merely relagate us to the docs, or make us jump through hoops. 👍

May 13, 2025 at 4:32 am #17025026

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Glad to hear that it is working now and if anything else comes up please do not hesitate to reach out, it's my pleasure.