Please make sure to update to WPML 4.3.4 before reporting any issue

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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

Last updated by severinP 1 year ago.

Assigned support staff: Itamar.

Author Posts
April 17, 2018 at 5:43 am #1654179

Gustaf Folin

When having two tabs or windows open with different languages, WC in combination with WCML will cause an infinite AJAX loop. Our page is on an internal network, but the same thing can be seen here: hidden link
* Open page in two tabs with different languages
* Add a product to cart in one of the tabs
* The tabs will now take turns to overwrite localStorage cart hash with AJAX calls.

Suggested fix:
Add filter to 'woocommerce_add_to_cart_hash' and calculate a hash that is the same regardless of language

April 18, 2018 at 12:35 pm #1673778

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

Thank you for contacting the WPML support forum.

I'm not sure that I see the issue on the link that you send me.
I follow the steps that you give, and I do not see any problem or any error in the browser's console. Please see attached screenshots.
Am I missing something?
If so, then please elaborate further on this issue.
Sometimes screen-shots illustrating what you mean may go a long way to clarify what words fail to transmit, so if you like, make use of “upload an image” below the comment area.

Thanks,
Itamar.

April 18, 2018 at 12:49 pm #1673954

Gustaf Folin

There won't be any errors in the console. Just endless AJAX requests.
For Chrome:
* Open in separate tabs:
* hidden link
* hidden link
* On English tab:
* Choose any color
* Click 'Add to cart'
* On Serbian tab:
* Press F5
* Check network tab on developer tools for any of the languages

April 19, 2018 at 8:08 pm #1703399

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi and thank you for the extra explanations.

Now, I can see the infinite look on your site.
On my local server with a clean WordPress installation, I cannot replicate this issue wing the steps that you give me.

I'll have to consult our second tier supporter about it and get back to you here.

Thanks,
Itamar.

April 22, 2018 at 4:36 pm #1752660

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi.

Our second tier supporter thinks that this issue might be related to caching.
He sees a special response header key “Vary” that seems to indicate this.
Do you use any caching plugin or most likely a caching method on your server or a caching service?
If so, does the problem persists when you deactivate all the caching methods?

To ensure the quickest and most accurate support, please provide your debug information so that I can get a look at some of your configurations.
We have an excellent article on how to located here: https://wpml.org/faq/provide-debug-information-faster-support/.

Thanks,
Itamar.

April 23, 2018 at 10:52 am #1764736

Gustaf Folin

I can't control the site that we used as an example, just grabbed one from the showcase. I tried disabling caching plugins on our internal site, and the problem is still there.
If we look in cart-fragment.js in WooCommerce:

// Refresh when storage changes in another tab
$( window ).on( 'storage onstorage', function ( e ) {
	if ( cart_hash_key === e.originalEvent.key && localStorage.getItem( cart_hash_key ) !== sessionStorage.getItem( cart_hash_key ) ) {
		refresh_cart_fragment();
	}
});

This will call refresh_cart_fragment() when session and local storage cart hashes differ.
refresh_cart_fragment() will do a request to WC_AJAX::get_refreshed_fragments() and update both session and local storage hashes. This will trigger the other tab.

Since the cart hash changes depending on language, the other tab will assume the cart has changed.

April 24, 2018 at 1:20 pm #1790122

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi and thanks for this detailed information. I've passed it to our second tier.
Please let me ask you if besides the infinite loop that is apparent in the browser console, do you get any other related issues? Does it break anything?

April 24, 2018 at 1:43 pm #1790627

Gustaf Folin

Hi,
Thank you for your answer. There are no effects beside the extra load on the server and bandwidth usage. The js penalty is probably minimal.

April 25, 2018 at 12:10 pm #1809040

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

I see. And also usually there will be no reason to open two tabs with different languages on the same browser. Can you agree with me on that?
In any case, I'm still consulting our second tier about it.

April 25, 2018 at 1:43 pm #1811140

Gustaf Folin

I completely agree, it's a very minor bug. Just wanted it to be on record if anything related comes up.

October 1, 2018 at 10:59 am #2777787

edvinB

I can confirm this bug. Even though I agree that it is a minor bug, it really becomes a big problem when working with a larger website with a larger team. If we have multiple people working on the site (e-commerce staff, support team, translators i.e.) this really affects the speed of the website when flooding the server with requests.

October 3, 2018 at 4:22 pm #2785229

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Hi, @edvinb.

You are writing: "If we have multiple people working on the site (e-commerce staff, support team, translators i.e.) this really affects the speed of the website when flooding the server with requests."

Are you sure that you have the same issue as in this ticket?
I'm asking this because this problem is happening on a single Chrome browser on a single computer when two tabs are open with different languages from the same site (the default language and the second language).
How can multiple people work at the same time from one single machine and browser?
Maybe you have another performance issue on your site?
If this is the case, please open a new ticket with your issue.

Thanks,
Itamar.

November 5, 2018 at 4:12 pm #2877494

edvinB

Hi Itamar,
Yes I am quite sure that this is the same issue. I do not mean that our staff works from the same machine, but it is quite common that a team member has our site open in multiple tabs/languages on their own computer.

What i meant was that having multiple people working at the same time increases the risk for this to happen, and the problem multiplies if it happens to more than one concurrent user!

i.e. The support team that is dealing with visitor live chats open tabs to see what the users are looking at.

Another example is that translators working on the site open the same page in other languages to maintain tonality and the message.

November 7, 2018 at 8:03 am #2883977

Itamar
Supporter

Languages: English (English ) Hebrew (עברית )

Timezone: Asia/Jerusalem (GMT+02:00)

Thanks for the details, @edvinb.

Since this ticket is closed already, I think that it would be best if you open a new ticket with this issue. In the new ticket, please give us your site's details and steps on how we can replicate the issue. You can assign this ticket to me if you want. Please also in your new ticket include the link to this ticket as a reference.

Best Regards,
Itamar.

January 24, 2019 at 1:27 pm #3125277

severinP

Hello, I have the same issue and can tell that it's causing another issue

When you add a product to the cart (or remove one) from one tab and go to the other tab the product added or removed will be reverted to how it was (because the session is being updated with the previous data)

Any fix comming up soon ?

For me it's a major issue because the loop only happens when two tabs of different language are open (because of the cart hash)
But the cart update issue happens on all tabs no matter the language so if you have multiple product tabs open and you add to the cart close the tab go to the other product add it to the cart, you go check the cart and there pouf it's gone, meaning confused customer, meaning revenu loss...

You can check on a clean install with WCML and WC 3.5.4 to see what I mean..