This is a Woocommerce site set up with 4 languages:
US - US English (default)
DE - German
EU - English site but for European customers
UK - UK English
The problem I've got is that if you start on the US site and add a product to cart you get sent to the EU site
If you then add to cart a 2nd time you now get sent to the UK site.
The correct behaviour is that a customer should stay on the language site they were on when adding to cart.
I can't figure out why this is happening.
I've seen a few threads saying to make sure this setting is enabled:
WPML > Languages > Store a language cookie to support language filtering for AJAX
this box is checked.
Please check if there are any warnings and notices in your admin related to WooCommerce.
Also check the status page in WooCommerce > WooCommerce Multilingual > Status - for any issues that might be there. It is possible that you are missing key WooCommerce pages in the other language, and because of that the issue could happen.
I also suggest to try in a minimal setup - with only WoooCommerce, WPML plugins and a default theme like "Storefront" if you can reproduce the issue - so that we can rule out any custom code issue.
Thanks for that. The status page in WooCommerce > WooCommerce Multilingual > Status showed that some store pages were missing and clicking that button has mostly fixed the issue - I am now not sent to other languages when adding to cart.
Having said that, the cart URLs do not look quite right and it looks like there may be some duplication somewhere. These are the cart URLS the site now uses:
hidden link hidden link hidden link hidden link
(I've printed them again below as relative URLs for the benefit of forum readers)
US site: /cart-2/
German site: /de/einkaufswagen/
UK site: /uk/cart/
EU site: /eu/cart-3/
The UK and German cart URLs are fine, but the US and EU cart have the extra -2 or -3 in them which makes our tracking/analytics more complicated.
Unfortunately it did not work for me 100%, when I try to edit the cart slug for USA to "cart" instead of "cart-2" it immediately resets.
I figured out "cart" slug was already taken in EU - in my list of EU pages I found 2 extra cart pages, so after deleting those I was able to rename the cart page to "cart", but for USA I cannot see another page with using the slug "cart" although I believe it exists.
How can I find and delete the US "cart" page so that I can free it up for "cart-2" to use instead?
Incidentally I think my slug problems were caused by the "WooCommerce Multilingual > Status" page fix buttons. It said content would not be created if it was not needed, but I ended up with multiple pages in some regions so that was not really true.
The cart functionality works perfectly now though, so thanks for your help.