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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 10:00 – 17:00 -
- 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 18:00 – 19:00 -

Supporter timezone: Asia/Kathmandu (GMT+05:45)

This topic contains 3 replies, has 0 voices.

Last updated by Shekhar Bhandari 1 month, 2 weeks ago.

Assisted by: Shekhar Bhandari.

Author Posts
July 20, 2026 at 4:59 pm #18167528

dupratS

Hello,
I've traced a reproducible bug in WooCommerce Multilingual and I think I've isolated the cause precisely, so I hope this saves your team some time.
Setup: WPML 4.9.5, WooCommerce Multilingual & Multicurrency, WooCommerce and all plugins on latest. Two languages, FR (default) and EN. "By default, show reviews in all languages" is enabled. Theme is Blocksy Pro.
Symptom: On a product with 50 French and 5 English reviews, the review list correctly displays all 55 in both languages, with flags and "(translated)" labels. But the aggregate figures beside the price show only the current language's count — "Rated 5.00 out of 5 based on 5 customer ratings (5 customer reviews)" on the EN page, and the equivalent native-only figure on FR. The tab label and the "N reviews for…" heading are wrong in the same way.
The stored data is correct. On both the original and the translation:
_wc_average_rating = 5.00 (EN) / 4.98 (FR)
_wc_review_count = 5 (EN) / 50 (FR)
_wcml_average_rating = 4.98 (both)
_wcml_review_count = 55 (both)
Diagnosis. WCML_Comments::filter_average_rating is registered on get_post_metadata from early in the request and stays registered throughout — but it returns unfiltered values until partway down the page. I logged get_post_meta() results and the filter's registration state at ten points in a single render:
wp count=5 avg=5.00 filter attached
template_redirect count=5 avg=5.00 filter attached
wp_head count=5 avg=5.00 filter attached
woocommerce_before_single_product count=5 avg=5.00 filter attached
woocommerce_before_single_product_summary count=5 avg=5.00 filter attached
woocommerce_single_product_summary count=5 avg=5.00 filter attached
woocommerce_after_single_product_summary count=5 avg=5.00 filter attached
comment_form_before (priority 1) count=5 avg=5.00 filter attached
woocommerce_after_single_product count=55 avg=4.98 filter attached
wp_footer count=55 avg=4.98 filter attached
The values change between comment_form_before and woocommerce_after_single_product. The only relevant code in that window is WCML_Comments::comments_link(), hooked to comment_form_before, whose call to get_reviews_count() does:
phpremove_filter( 'get_post_metadata', [ $this, 'filter_average_rating' ], 10, 4 );
...
add_filter( 'get_post_metadata', [ $this, 'filter_average_rating' ], 10, 4 );
That re-registration is what makes the filter take effect. Everything rendered before the reviews section — which is every place a customer actually sees the rating — gets the raw per-language values.
Confirmation. I added a snippet that locates WCML's own callback and re-registers it at wp priority 99, changing nothing else. The same trace then returns 55 / 4.98 from template_redirect onward, and both language versions display 55 correctly across all products. So re-registration alone is the operative step.
Not a conflict. I ruled out page and CDN caching (the fault reproduces in a freshly rendered, logged-in, cache-bypassed request), stale meta, custom snippets, and the theme.
URLs:

EN: hidden link (post 31413)
FR: hidden link (post 31277)

I'm currently running the workaround, so those pages show the corrected figures. I can deactivate it if you'd like to observe the fault directly — just say the word.
One caveat: the source I quote above is from the public GitHub mirror of WooCommerce Multilingual, which may lag 4.9.5. The observed behaviour matches it exactly, but the current code may differ.
Best regards,
Vahana

July 22, 2026 at 8:34 am #18170731

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you with this issue.

Thank you as well for the detailed investigation and for sharing your findings. I appreciate the time you took to narrow down the behavior and document your observations.

To help us verify this further, I have created a clean test site:
hidden link

I also created a test product here:
hidden link

On my end, the review count and rating are displayed correctly. Could you please try reproducing the same issue on this clean test site by following the same steps you used on your website? If you are able to reproduce the issue there, it will help us determine whether this is a general WCML issue and allow us to investigate it further.

I look forward to your reply.

Thanks.

July 23, 2026 at 2:55 pm #18174122

dupratS

Hello Shekhar, as you know from the other ticket that i have cloned the live site to staging. turned off all the plugins and that seemed to solve the issue. indicating there must be a conflict with one for the plugins , not related to WPML. So I will trouble shoot this after the other ticket is solved. thank you for your help.

July 24, 2026 at 4:41 am #18174637

Shekhar Bhandari
Supporter

Sure, will wait for your feedback.

The topic ‘[Closed] WCML review count filter ineffective until re-registered mid-render — aggregate shows native-langu…’ is closed to new replies.