 denisW-4
|
Hi,
No, we've been here already - this does not work, it breaks caching. Adding this cookie into "Do not cache" makes all the pages uncacheable.
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Thank you for your feedback. I'm consulting this with our 2nd-tier specialists.
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Hi there,
Please add this code to the functions.php file located in the active theme's folder:
/**
* Add a url parameter lsed=1 to language switcher URLs to be able to detect
* when a page loads after switching language.
*/
add_filter( 'icl_ls_languages', function( $w_active_languages ){
foreach ($w_active_languages as $lang => $w_active_language) {
$w_active_languages[ $lang ]['url'] = add_query_arg( 'lsed', 1, $w_active_language['url'] );
}
return $w_active_languages;
}, 1000, 1 );
And confirm that the issue is solved.
|
 denisW-4
|
All this does is add a parameter into the URL when using the language switcher. And on the test website this parameter (lsed) has been added into "Do Not Cache Query Strings".
So, of course when adding this code into the test website, the pages are no-cache if the parameter is present in the URL...
Page set to no-cache = no problem with language.
Page set to cache = problem with language <- we are trying to fix there.
Very weird solution to provide considering all the info I previously gave. The language issue is not only when using the language switcher, it's sometimes even there for new users, first time on the website.
Thanks.
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Hi,
Thank you very much for your feedback.
I'm sharing this message with our 2nd-tier specialists and I will get back to you as soon as I have an answer.
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Hello,
I'm quoting our 2nd-tier specialist:
In the specific scenario where a site visitor uses the language switcher, only the subsequent page load is not from the cache. Any other page load is unaffected, and is still delivered from the cache. The solution offered specifically targets what happens if clients use the language switcher, which would be a small minority of page visits, something that most clients would do only once, if at all.
|
 denisW-4
|
Hi Carlos,
I understand the thought of the 2nd-tier specialist now. While this does not fix the root of the issue, this might be a acceptable band-aid fix. Since this way there is almost no (logical) way to 'bring' the wrong/previous mini cart language into the other language page' cache.
The only way to still 'bring' the wrong/previous language cart would be to change URL in the current browser like from /fr/ to /en/. But after two months I am kind of done with this problem, so let's ignore this one.
I will add this fix into the main website and test a couple days to see how thing go.
Thank you!
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Great!
I will be waiting for your feedback.
|
 denisW-4
|
I thought this would be it, but no... the thinking of the specialist was right, but unfortunately this problem goes deeper.
I added it to the main website, did some tests which seemed to go good at first. I had to change one small thing due to some of my pages having parameters I cannot change: now when using the language switcher you always go to the new language homepage with the ?lsed parameter - but that's fine, same no-cache effect.
Then I triggered /de/?wc-ajax=get_refreshed_fragments while being on /de/?lsed=1 (no-cache page). And boom, the cart refreshed into the Dutch language, while we are on a German page + set to no-cache...
Then on the German page I changed quantity of something in the cart, and the cart language changed to English... (trigger: /wp-admin/admin-ajax.php?lang=de&action=buwoo_update_cart_item_quantity&cart_key=dcd2..[..]..)
If you want you can see it happen on the main website mr - ezy .com. It's just how this BricksUltimate plugin handles the caching/language within his modules/elements. I asked him again to help but he still couldn't find the issue...
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
The issue appears to be specific to the Bricks Unlimited mini-cart. When using the default Bricks mini-cart, everything functions correctly with WPML and no custom solution is necessary.
Please note that Bricks Unlimited is not listed among our officially compatible plugins: https://wpml.org/plugin/
. While we aim to assist with such cases, support for non-compatible or minor third-party plugins is limited. We've already done some investigation on our side, and based on our findings, we recommend one of the following approaches:
- Use the default Bricks mini-cart, which works as expected with WPML.
- Contact the Bricks Unlimited plugin author to encourage them to join our Go Global program
and make their plugin officially compatible with WPML.
We’re happy to continue helping as much as possible, but for long-term compatibility, direct action from the plugin developer is essential.
|
 denisW-4
|
Hi,
I fully understand and agree.
I would like to thank you and the 2nd-tier specialist for your time!
Kind Regards,
Denis
|
 Carlos Rojas
WPML Supporter since 03/2017
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/Madrid (GMT+02:00)
|
Hi Denis,
Thank you very much for your understanding!
Please don't hesitate to contact us if you need our help with WPML.
Have an excellent day!
|