Ffile2fix
Sign in Get started

How to fix WooCommerce "Sorry, your session has expired"

Sorry, your session has expired. Return to shop

WooCommerce keeps each shopper's cart in a session identified by a cookie and stored in the woocommerce_sessions table. At checkout the session or cart could not be found or verified, so WooCommerce cannot place the order and sends the shopper back to the shop.

Also appears as: Sorry, your session has expired. · WooCommerce cart empties at checkout: session has expired · We were unable to process your order, please try again.

Common causes

  • Cart, checkout or My Account pages being cached by a plugin, host cache or CDN
  • The wp_woocommerce_session_ cookie being stripped or set for the wrong domain (www vs non-www)
  • A security or cookie-consent plugin blocking WooCommerce's cookies
  • The woocommerce_sessions table is corrupted, full or not writable
  • Checkout nonce failing because the checkout page HTML was cached
  • Mixed HTTP/HTTPS URLs causing secure cookies to be dropped

How to fix it

  1. Exclude WooCommerce pages from caching. In your cache plugin, host cache (LiteSpeed, Varnish, Nginx FastCGI) and CDN, bypass /cart/, /checkout/, /my-account/ and any request with woocommerce_items_in_cart or wp_woocommerce_session_ cookies.
  2. Check the site URL and SSL. Ensure Settings > General uses one https:// URL that matches the address customers use, and redirect the other host variant.
  3. Clear WooCommerce sessions. Go to WooCommerce > Status > Tools and run 'Clear customer sessions'. Note this empties all current carts.
  4. Check the sessions table. In phpMyAdmin run CHECK TABLE on wp_woocommerce_sessions and repair if needed; database errors in debug.log often point here.
  5. Disable conflicting plugins. Test with only WooCommerce and a default theme active (Health Check troubleshooting mode). Cookie-consent, security and minification plugins are common culprits.
  6. Review WooCommerce logs. Check WooCommerce > Status > Logs for fatal-errors and payment gateway logs from the time of the failure.

WP-CLI

wp db query "CHECK TABLE wp_woocommerce_sessions;"
wp db query "SELECT COUNT(*) FROM wp_woocommerce_sessions;"
wp cache flush

How to stop it happening again

  • Keep cart, checkout and account pages permanently excluded from all caches
  • Test checkout as a guest after every caching or CDN change
  • Make sure WP-Cron runs so expired sessions are cleaned regularly

Frequently asked questions

Why does it only happen to some customers?

Usually those who hit a cached copy of the checkout page or use strict browser privacy settings that block cookies. Logged-in customers may bypass the cache and never see it.

Will clearing customer sessions lose orders?

No, orders are stored separately. Clearing sessions only empties active carts, so customers need to re-add items.

How long do WooCommerce sessions last?

By default about 48 hours, renewed while the shopper is active. Expired sessions are removed by a scheduled cleanup task.