Skip Navigation

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

Problem:
If you're experiencing issues with WooCommerce reviews not being translated on the frontend and are displayed in their original language, it might be due a known issue: https://wpml.org/forums/topic/country-flag-on-product-review-shows-up-in-current-language-instead-of-the-language-of-the-client/#post-13998081.

Solution:
For more details on related issues, visit WPML support forum.

If this solution does not apply to your case, or if it seems outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket.

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 1 voice.

Last updated by Marcel 1 month ago.

Assisted by: Marcel.

Author Posts
January 29, 2025 at 9:46 am #16645352

basv-25

I'm discussing this with Kinsta right now. CDN is also off at our staging site... Hope they can come up with something...

In the meantime I added an old PHP code I've received from WPML a while ago, it had to do with the country flags.

Now the reviews appear translated. Can you see what this code does? And maybe we can find a solution from there?

Thanks!

/*-----------------------------------------------------------------------------------*/
/* Show correct country flags on reviews - temp fix from wpml
/*-----------------------------------------------------------------------------------*/
add_filter ('the_comments', 'remove_hooks10903');

function remove_hooks10903($var) {

global $wp_filter;

foreach ( $wp_filter["the_comments"]->callbacks[10] as $key => $value ) {

if ( str_contains( $key, 'translate_product_ids' ) ) {

remove_filter( 'the_comments', $key );

}

}

return $var;

}

January 29, 2025 at 10:29 am #16645556

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

As far as I can see, Cloudflare is still active. They might want to try fully deactivating it to check if that resolves the issue.

The code you mentioned addresses the following issue: "The country flag on product reviews appears in the current language instead of the client's language." This issue is still open, and the code can still be used if you're experiencing the still the same problem as in the past.

That said, in my tests, previously translated reviews appeared correctly without requiring any modifications.

Best regards,
Marcel

January 29, 2025 at 10:33 am #16645575

basv-25

Hi Marcel,

According to Kinsta, Cloudflare is not active staging hidden link

Is Cloudflare really active to your opinion?

Thanks

January 29, 2025 at 10:42 am #16645628

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

I can't say if Cloudflare is active or not, but it's still routed through Cloudflare:

marcel@MARCEL-NB:~$ ping stg-bloomming-staging.kinsta.cloud
PING stg-bloomming-staging.kinsta.cloud (162.159.134.42) 56(84) bytes of data.
64 bytes from 162.159.134.42: icmp_seq=1 ttl=54 time=13.6 ms 

Reverse DNS (PTR) <no PTR record>
AS number AS13335
AS name (ISP) Cloudflare, Inc.
IP-range/subnet 162.159.128.0/19
Location United States (US)

Best Regards,
Marcel

January 29, 2025 at 10:50 am #16645667

basv-25

Thanks Marcel,

I've double checked with Kinsta and it appears that the website is hosted at cloudflare:

Our platform is built on Cloudflare; With our Cloudflare integration, Kinsta customers benefit from a more secure firewall with included DDoS protection, high-performance CDN, Edge Caching, HTTP/3 support, wildcard SSLs, and more.
But caching is only on the server (Server cache), The CDN (Cloudflare) and Edge caching (Cloudlfare)
The Server cache is disabled by default on staging.
There is no CDN or Edge caching on staging, if you check the caching page in MyKinsta, it only shows server caching and Redis. The Server caching is disabled and Redis is not enabled as it's an add-on service, which means you only enable it when you need it on your site such as to cache database requests, and it's with a cost attached to it,

So no caching layer is active from our end or from our Cloudflare integration on your staging website.

January 29, 2025 at 11:36 am #16645964

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

There's nothing more I can add as long as it works on my localhost. No changes have been made to the site—it's deployed as is. I can't detect or debug anything further from our side.

The only option I can offer is to set up an instance on a Cloudways server, where you can migrate the site. If the issue is resolved there as well, it would serve as proof for Kinsta to investigate further.

Best regards,
Marcel

January 29, 2025 at 1:55 pm #16647122

basv-25

Hi Marcel, ok understood. Good idea to create a version on Cloudways, if you can help me with that it would be very much appreciated.

Thanks,

January 30, 2025 at 9:39 am #16650199

basv-25

Good morning Marcel,

I think I know why the reviews on your localhost show up translated.

I think this is because you're using the Salient Child theme which has this custom code in its functions.php

/*-----------------------------------------------------------------------------------*/
/* Show correct country flags on reviews - temp fix from wpml
/*-----------------------------------------------------------------------------------*/
add_filter ('the_comments', 'remove_hooks10903');

function remove_hooks10903($var) {

global $wp_filter;

foreach ( $wp_filter["the_comments"]->callbacks[10] as $key => $value ) {

if ( str_contains( $key, 'translate_product_ids' ) ) {

remove_filter( 'the_comments', $key );

}

}

return $var;

}

Can you switch to twenty twenty theme and check if the reviews still show up as translated?

Thank you so much.

January 30, 2025 at 10:53 am #16650693

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

Yes, that's correct. It only functions with the child theme that includes this modification.

Best regards,
Marcel

January 30, 2025 at 11:20 am #16650972

basv-25

Hi Marcel, thank you for your prompt reply. But if I understand it well, then the translations aren't visible on the localhost as well without the use of additional coding?

January 30, 2025 at 11:38 am #16651059

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Correct, this will only work with the additional code inside the child theme.

For now, it's best to keep the child theme active where the workaround is active. Once we have a solution, it will be implemented through WooCommerce Multilingual, as mentioned in your previous ticket.: https://wpml.org/forums/topic/country-flag-on-product-review-shows-up-in-current-language-instead-of-the-language-of-the-client/#post-13998081

Best Regards,
Marcel

January 30, 2025 at 12:05 pm #16651253

basv-25

Hi Marcel,

Sorry but I'm a bit confused now. The custom code was for showing the correct flags with the reviews at this was a temp solution from 2023. I don't expect that there will be a fix any time soon. (we didn't have translations for the reviews at that time).

But what about the translations that aren't showing up (without the custom code)? Is this a problem within WPML or with our host Kinsta?

Or do you recommend to keep using this code on our live environment to make the translations visible? If so then thats also a good solution, the reviews show up well on the woocommerce product pages.

But not on the woocommerce all reviews block used on this page:
hidden link

Is it possible to adjust the code so also the reviews appear translated on the "all reviews block"?

January 30, 2025 at 5:45 pm #16653160

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

But what about the translations that aren't showing up (without the custom code)? Is this a problem within WPML or with our host Kinsta?

Since the translations work with the custom code, I can no longer confirm that this is an issue with your host.

Or do you recommend to keep using this code on our live environment to make the translations visible? If so then thats also a good solution, the reviews show up well on the woocommerce product pages.

Yes, that’s the purpose of the workaround we provided.

But not on the woocommerce all reviews block used on this page:
hidden link

Is it possible to adjust the code so also the reviews appear translated on the "all reviews block"?

The issue on the product page is a bug since something isn’t working as expected. However, from what I can see, the "All Reviews" block doesn’t currently support translated reviews by design. We can explore whether this could be considered as a feature request, but I can’t guarantee if it will be approved by our developers.

Best regards,
Marcel

January 31, 2025 at 11:12 am #16655087
basv-25

Hi Marcel, with the use of the custom code the reviews appear well now on all product pages, so that is really nice.

For the all reviews block, this is a standard woocommerce block and I believe it is handled by WPML. See this https://wpml.org/forums/topic/how-to-show-customer-reviews-block-originally-in-any-language/ topic as well.

It should show the translated reviews. But I'm afraid that because of I need to use custom code to show the translated reviews on the product pages, that I need custom code to make it work with the all reviews block as well. Can your team look into this please?

Thanks so much.

New threads created by Marcel and linked to this one are listed below:

https://wpml.org/forums/topic/woocommerce-reviews-on-reviews-block/

January 31, 2025 at 6:00 pm #16656915

Marcel
Supporter

Languages: English (English ) German (Deutsch )

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

Hi,

I've separated the review block into a new ticket.

Since you're now using the code workaround on the product page and it's working, I will go ahead and close this case as resolved.

Best regards,
Marcel