Skip Navigation

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

Problem:
You are experiencing an issue where switching languages on a WooCommerce product page results in too many redirects. This problem began after updating WooCommerce from version 9.4.3 to 9.5.2. Changing the permalink settings from 'Shop base with category' to 'Shop base' temporarily resolves the issue, but downgrading to WooCommerce 9.4.3 also fixes it.
Solution:
We have identified this as a known issue with the latest WooCommerce update. While our developers are working on a permanent fix, we recommend two workarounds:
1. Disable the "Auto adjust IDs" setting in WPML > Languages.
2. Insert the following code into your theme's functions.php file:

add_action( 'after_setup_theme', function() {<br />    remove_action( 'template_redirect', 'wc_product_canonical_redirect', 5 );<br />} );

These steps should help mitigate the problem temporarily. If these solutions do not resolve your issue or if they become irrelevant due to future updates, please check our related known issues and ensure you have the latest versions of themes and plugins. If the problem persists, we highly recommend opening a new support ticket for further assistance.

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

Last updated by Jens Pauwels 1 month, 3 weeks ago.

Assisted by: Kor.

Author Posts
January 13, 2025 at 3:50 pm #16589362

Jens Pauwels

Background of the issue:
I am trying to switch languages while viewing a WooCommerce product page, but I encounter an issue. This problem started after updating WooCommerce from 9.4.3 to 9.5.2. When I change the permalink settings for products from 'Shop base with category' to 'Shop base', the issue disappears. Downgrading WooCommerce back to 9.4.3 resolves the issue with the original permalink setting.

Symptoms:
When I switch my language on a product page, I receive an error message stating there are too many redirects.

Questions:
Is this an issue of WPML not accounting for changes in WooCommerce version 9.5 and above?

January 13, 2025 at 4:09 pm #16589771

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience.

Here is the ticket. I will need to closely examine your website. Therefore, I will require temporary access (WP-Admin and FTP) to a test site where the problem has been replicated, if possible. This will enable me to provide better assistance and determine if any configurations need to be modified.

Please note that it is important to have a backup for security purposes and to prevent any potential data loss. You can use the UpdraftPlus plugin (https://wordpress.org/plugins/updraftplus/) to fulfill your backup requirements.

Your upcoming reply will be treated with confidentiality and will only be visible to you and me.

✙ To resolve the issue, I may need your consent to deactivate and reactivate plugins and the theme, as well as make configuration changes on the site if necessary. This emphasizes the significance of having a backup.

January 14, 2025 at 3:03 pm #16593547

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your reply.

I'm able to replicate it on this product hidden link

This is our login link to the sandbox site : hidden link

I will report this to our 2nd Tier Support and I will come back to you once I've feedback.

January 15, 2025 at 5:33 pm #16598679

Kor
Supporter

Languages: English (English )

Timezone: Asia/Singapore (GMT+08:00)

Thanks for your patience. Our 2nd Tier Support checked and confirmed that this is a known issue and our devs are working on a fix.

In the meantime, there are two workarounds you can use to fix this.

First Workaround : Disable "Auto adjust IDs" setting in WPML > Languages

Second Workaround : use this code in theme functions.php:

add_action( 'after_setup_theme', function() {
    remove_action( 'template_redirect', 'wc_product_canonical_redirect', 5 );
} );
January 20, 2025 at 7:36 am #16611866

Jens Pauwels

The second workaround fixed my issue!
When I look at the solutions, the problem seems to originate from the theme. But why did the problem start occurring when I updated WooCommerce to the latest version?