Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Language switch loses cart or form data: how to find and fix it

CNV-337Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A visitor adds products to a cart or starts a form, then uses the language switcher. They land on the translated page and the cart is empty, or the form fields are blank. The data was not deleted on purpose. The new page simply cannot see it.

Common causes: the languages live on different domains (example.com and example.fr) so cookies are not shared; the cookie is set for one subdomain only (www versus fr); the translation plugin keeps a separate cart per language; the switcher is a full page reload that drops form input; or the URL change drops a cart token or session parameter.

Why it costs you leads or sales

The people who switch language are often the ones who need it to understand the offer or the checkout. They have already shown intent by filling a cart or a form. An empty cart after the switch looks like a bug, and many will leave instead of rebuilding it. It also hides in your reports: the loss looks like ordinary abandonment.

Visitors who switch language mid-journeyExample numbers
Visitors who switch language mid-journey (example)Cart kept after switch: 60 %; Cart lost after switch: 15 %023466015Cart kept after switchCart lost after switch%

Example: out of visitors who switch language with items in the cart, how many go on to buy. Numbers are illustrative.

Where the journey breaks
  1. Add to cartItems stored in session
  2. Switch languageNew domain or session starts
  3. Cart pageCart shows empty
  4. CheckoutNever reached

The cart is lost at the language switch, so the later steps never happen.

How to check if your site has it

Manual test (5 minutes)
  1. Open a private window

    Start with no cookies so you see what a new visitor sees.

  2. Add a product to the cart

    Note the product, quantity and any discount code.

  3. Switch language with the site switcher

    Do not edit the URL by hand. Use the real switcher on the cart page and on a product page.

  4. Open the cart and checkout

    Check items, quantity, coupon and shipping country are all still there.

  5. Repeat with a form

    Fill half a lead or checkout form, switch language, and see whether the fields keep their values.

  6. Check the cookies

    In browser DevTools, open Application > Cookies. Compare the cookie domain before and after the switch. A new domain or a new session cookie value points to the cause.

How to fix it

The right fix depends on how your languages are set up. Pick your platform below. If the languages are on separate domains, browsers will not share cookies between them, so you need to pass the cart across with a token in the link or use one domain with language folders.

Fix by platform
  1. Use one domain for all languages

    In your translation plugin (for example WPML or Polylang), choose language in directories (/fr/) rather than per-domain where you can. Cookies are then shared.

  2. Check cart and session settings

    If you use WooCommerce with WPML, make sure the cart is kept when the language changes. WPML has a WooCommerce Multilingual setting for this. Check the plugin docs for your version.

  3. Exclude cart pages from caching

    Make sure the cart, checkout and account pages are not cached per language, so the cart fragment loads correctly.

Keep form values when the language link is clickedjavascript
document.querySelectorAll('a[data-lang-switch]').forEach(function (link) {
  link.addEventListener('click', function () {
    var data = {};
    document.querySelectorAll('form input, form textarea, form select').forEach(function (el) {
      if (el.name && el.type !== 'password' && el.type !== 'file') data[el.name] = el.value;
    });
    sessionStorage.setItem('formDraft', JSON.stringify(data));
  });
});

window.addEventListener('DOMContentLoaded', function () {
  var saved = sessionStorage.getItem('formDraft');
  if (!saved) return;
  var data = JSON.parse(saved);
  Object.keys(data).forEach(function (name) {
    var el = document.querySelector('[name="' + name + '"]');
    if (el && !el.value) el.value = data[name];
  });
  sessionStorage.removeItem('formDraft');
});
Language switch before and after

Before

  • Switcher links to another domain
  • New session cookie is created
  • Cart is empty and form is blank

After

  • All languages share one domain or a cart token
  • Same session cookie is kept
  • Cart and form values survive the switch

How to confirm it's fixed

Confirmation checklist
  • Cart keeps products, quantity and coupon after switching language
  • Checkout opens in the new language with the same cart
  • Half-filled form keeps its values, or the visitor is warned
  • The session cookie value is the same before and after the switch
  • Works in a private window and on mobile
  • Works from the cart page, product page and checkout

How to prevent it happening again

Add the language-switch test to your release checklist. Run it after changing translation plugins, themes, domains, cookie or cache settings, and after adding a new language. Keep the languages on one domain when you can.

How FunnelGuard handles this

FunnelGuard does not check this yet. A language switch that empties the cart is a possible future check, but it is not built today.

What FunnelGuard does do is run your real customer journeys on a schedule, such as lead forms, checkouts and booking buttons, check each step and the tracking hits, and confirm test leads reach the inbox and CRM. If a broken cart stops a journey you have set up, that journey can fail at the step where the cart should be. It does not test switching language in the middle of a journey.

Cart lost on language switch

The visitor switches language and the new page has no cart.

Questions people ask

Why is my cart empty after I change the language?

The translated page is probably on a different domain, subdomain or session, so it cannot read the cookie that holds your cart. It can also be a translation plugin that keeps a separate cart per language. Check the cookie domain before and after the switch.

How do I keep the cart when switching languages on Shopify?

Use the Shopify Markets language selector with languages on the same domain or in subfolders. A custom switcher linking to another store URL can start a new cart. Always test with items in the cart.

Why does the language switcher clear my form?

The switcher loads a new page, and the browser does not carry typed values to it. You can save field values to sessionStorage before the click and restore them on the next page. This works only on the same domain.

Does WPML keep the WooCommerce cart when I change language?

It can, if WooCommerce Multilingual is set up correctly and cart pages are not cached per language. Test it with items in the cart. Check the plugin's documentation for your version.

Do separate domains for each language lose the cart?

Yes, by default. Browsers do not share cookies between different domains, so each domain starts a new session. Use one domain with language folders, or pass a signed cart token in the switcher link.

How do I test if a language switch loses data?

Open a private window, add an item to the cart, then use the site's own language switcher. Check the cart, the checkout and a half-filled form. Compare the session cookie before and after in DevTools.

Can FunnelGuard detect a cart lost on language switch?

Not yet. This check is not built, so use the manual test. FunnelGuard does run your real journeys on a schedule and checks each step, which may show a broken cart if it stops a journey you have set up.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.