On this page
What this issue is
A shopper adds a product, sees it in the cart, clicks to another page and finds the cart empty. The store has forgotten the basket. Most carts are remembered with a small cookie (a text file the browser keeps) that holds a cart or session ID. If that cookie is missing, not sent, or points to a session the server no longer has, the cart looks empty.
Why it costs you leads or sales
Shoppers who have chosen a product and lose it rarely start again. They leave, and you never see an error because nothing crashed. The ad click, the product view and the add to cart all happened, so reports can look healthy until the sales line stays flat.
- Product pageItem added to cart
- Cart pageItem shown
- Checkout linkGoes to another host or loses cookie
- CheckoutCart is empty
- OrderNever placed
The cart is fine until the shopper crosses to a page that cannot read the cart cookie.
Example: illustrative numbers only. If the cart empties for a share of shoppers, completed orders fall by about the same share.
How to check if your site has it
Use a private window
Open a new private or incognito window so old cookies do not hide the problem.
Add a product and click through
Go from product to cart, to checkout, back to the shop and to the cart again. Note the exact page where the items vanish.
Check the address bar
Look for a change of host, such as www.example.com to example.com, or to a separate checkout domain, at the moment the cart disappears.
Inspect the cookies
In Chrome DevTools open Application, then Cookies. Look for the cart or session cookie (for example cart on Shopify, woocommerce_cart_hash and wp_woocommerce_session_ on WooCommerce). Check its Domain, Path, Expires and SameSite values before and after the bad step.
Repeat on mobile and in other browsers
Try Safari on iPhone and a browser with strict tracking protection. Some failures only appear there, or inside in-app browsers from social apps.
| Symptom | Likely cause |
|---|---|
| Cart empties when the host changes (www or non-www) | Cookie set for one hostname only |
| Cart empties at checkout on another domain | Cart cookie not shared with the checkout domain |
| Cart empty on reload, shows for some visitors only | Page cache serving a cached empty cart |
| Cart empties after a few minutes | Session or cookie expires too fast |
| Cart empties only on iPhone or in-app browsers | Cookie blocked or SameSite setting |
| Cart empties after login | Guest cart not merged with the account cart |
How to fix it
Fix the cause that matches your test. Start with the host and cache checks, because they are the most common and the quickest.
Force one hostname
Pick www or non-www and 301 redirect the other, so the cart cookie always belongs to the host the shopper is on. Also force https.
Exclude cart pages from caching
Cart, checkout and account pages, and the cart cookie, must never be served from a page or CDN cache.
Share the cookie across subdomains if needed
If checkout runs on a subdomain, set the cookie domain to the parent domain (for example .example.com).
Check cookie lifetime and SameSite
Make sure the cart cookie lasts at least the browsing session and uses SameSite=Lax unless a cross-site flow truly needs None with Secure.
Retest in a private window
Repeat the click-through test on desktop and mobile.
Exclude WooCommerce pages from cache
In your caching plugin, exclude the Cart, Checkout and My account pages, and the cookies woocommerce_items_in_cart, woocommerce_cart_hash and wp_woocommerce_session_. Do the same in any server or CDN cache.
Match the site address
In Settings, General, make WordPress Address and Site Address use the same host and https. Redirect the other host to it.
Check for plugin conflicts
Switch to a default theme and disable plugins other than WooCommerce briefly on a staging copy to see if the cart holds.
Set the primary domain
In Settings, Domains, set one primary domain and redirect the others to it, so shoppers do not switch hosts mid-session.
Check theme cart code
If you use custom code or an app that calls /cart/add.js or /cart/change.js, make sure it does not clear or replace the cart. Test with the app disabled.
Review custom checkout links
Links to checkout from landing pages or headless pages should use the store domain so the cart cookie is sent.
Look for tags that redirect or reload
In Preview mode check for custom HTML tags that change window.location or reload the page after add to cart.
Pause suspect tags
Pause them in a test workspace and repeat the cart test.
Use one domain for the site
In Project settings, Hosting, set a default domain and make sure the www and non-www versions redirect to it.
Check Ecommerce settings
Make sure cart and checkout links use the published domain, not the webflow.io staging address.
Keep the funnel on one custom domain
Use the same connected domain for the product, cart and checkout steps of the funnel instead of mixing the default and custom domains.
Test the order form step
Open the funnel in a private window and confirm the product stays selected from one step to the next.
Set one primary domain
In Domains, set the primary domain so the cart is not split between the wixsite.com address and your own domain.
Test with cookie settings
If you use a cookie banner, check that essential cookies for the cart are not blocked until consent.
Pick the primary domain
In Settings, Domains, set the primary domain so other versions redirect to it.
Check Cookies and Visitor Data
Make sure the cookie banner does not block the cart cookie for shoppers who decline optional cookies.
Set cookie attributes correctly
Set the session or cart cookie with a stable Domain, Path=/, Secure and SameSite=Lax, and a sensible lifetime.
Share session storage across servers
If you run several servers, store sessions in a shared store such as a database or Redis, not in each server's memory.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]setcookie('cart_id', $cartId, [
'expires' => time() + 60 * 60 * 24 * 7,
'path' => '/',
'domain' => '.example.com',
'secure' => true,
'httponly' => true,
'samesite' => 'Lax',
]);Before the fix
- Shopper adds item on www, checkout opens on non-www
- Cart cookie not sent to the new host
- Checkout shows an empty cart
After the fix
- One hostname forced with a 301 redirect
- Cart pages excluded from cache
- Same items shown from product to checkout
How to confirm it's fixed
- In a private window, the cart keeps its items from product to cart to checkout
- The cart cookie keeps the same value across those pages
- Both www and non-www open the same host after redirect
- Items still show after a reload and after 10 minutes idle
- The cart holds on iPhone Safari and an Android browser
- The cart holds with a cookie banner declined
How to prevent it happening again
- Retest the full cart journey after every theme, plugin, app or cache change
- Keep cache exclusions in writing so they survive a plugin or host migration
- Use one canonical domain and keep redirects in place after a domain change
- Test on mobile and with a cookie banner declined, not only on your own desktop
- Run the cart journey on a schedule, not only after releases
How FunnelGuard handles this
FunnelGuard detects this issue only partly. A robot visitor runs your real customer journey on a schedule, and if the journey fails at checkout, for example because the cart arrives empty and the checkout step cannot be completed, that step is flagged. The failure is re-checked from a second region, then one alert goes out with a screenshot and a likely cause.
Questions people ask
Why does my shopping cart empty itself when I go to another page?
The site has lost the cookie or session that identifies the cart. Common causes are a switch between www and non-www, a separate checkout domain, a page cache serving a stale cart, or a cookie that is blocked or expires too soon. Note the page where the items vanish to narrow it down.
Why is my WooCommerce cart empty after adding a product?
Most often a caching plugin, host cache or CDN is caching the cart or checkout page, or the WooCommerce session cookies are being stripped. Exclude the Cart, Checkout and My account pages and the woocommerce session cookies from every cache layer, then retest in a private window.
Why is my Shopify cart empty at checkout?
Check that shoppers stay on one primary domain in Settings, Domains, and that no app or custom code clears the cart through /cart/change.js or replaces it. Also make sure links to checkout from landing pages use your store domain so the cart cookie is sent.
How do I check if the cart cookie is being saved?
Open Chrome DevTools, go to Application, then Cookies, and select your site. Add a product and watch for the cart or session cookie. Check that its Domain matches the page you are on and that its value stays the same when you change pages.
Why does the cart empty only on iPhone or in social media browsers?
Safari and in-app browsers apply stricter cookie and tracking rules. A cart cookie with the wrong SameSite value, or one set from a different domain, may be dropped. Use SameSite=Lax, keep the cart on your own domain and test on real devices.
Can a cookie banner make the cart empty?
Yes, if it blocks the cookie that stores the cart. Cart and session cookies are normally treated as essential and should be allowed even when a visitor declines optional cookies. Test the cart with the banner declined.
Can FunnelGuard detect a cart that empties between pages?
Partly. It runs your purchase journey on a schedule and flags it when the journey fails at checkout. It does not identify the exact cookie or cache setting, and it may miss problems that only affect some browsers or visitors, so test those by hand.