Eren Labs JOURNAL TR
WooCommerce Errors

“Sorry, your session has expired” in WooCommerce: why the cart was empty at checkout

WooCommerce shows this when the checkout is submitted or refreshed and the shopper's cart is empty. The cart lives in a session tied to a cookie, so the causes are the ways that cookie or session gets lost.

In this article14 sections

This notice means that when the checkout was submitted or refreshed, WooCommerce found the shopper’s cart empty. The shopper can still see items on the checkout page they loaded earlier, but the server no longer has them.

A WooCommerce cart is stored in a session on the server, and the shopper’s browser holds a cookie that points to it. Anything that loses the cookie, ends the session or empties the cart produces this message.

The exact message#

Sorry, your session has expired. Return to shop

Who sees it: Shoppers on the classic checkout. It appears after pressing Place order, or in place of the whole checkout form when the page refreshes its order summary. Return to shop links to the shop page. The checkout block doesn’t use this message.

What WooCommerce checks#

Each request, WooCommerce reads the wp_woocommerce_session_ cookie and loads the matching session from the database:

  1. No cookie means a new, empty session.
  2. A cookie past its expiry, or one that belongs to a customer who has since logged out, is thrown away and the cart is emptied.
  3. Guest sessions last two days and logged-in customers’ sessions a week, by default.

When Place order is pressed, WooCommerce checks the form’s security token, which for guests is tied to the session. If the token fails and the cart is empty, or the cart is empty anyway, it shows this message. The checkout also refreshes its order summary when the address or shipping changes, and if the cart is empty at that moment the whole form is replaced with the message.

Causes and how to fix each one#

1. The cart was emptied in another tab#

The checkout tab shows the cart as it was when the page loaded. If the shopper removed the items, or finished an order, in another tab, the server’s cart is empty. Bank transfer, cheque and cash on delivery empty the cart as soon as the order is placed, and the order received page empties it too, so a second Place order in an older tab gets this message.

Check: Look in WooCommerce > Orders for an order from the same customer placed just before.

Fix: Nothing to fix if the order went through. Tell the customer their first order succeeded.

If the browser blocks cookies, or the cookie was set for a different address, every request starts a new, empty session. The cookie is set for the site’s domain and path, so a store reached as both www and non-www, or as both http and https, can lose carts when the shopper moves between them. Privacy extensions and in-app browsers can also drop cookies.

Check: In a private window, add a product and check in the browser’s developer tools that a wp_woocommerce_session_ cookie exists and survives the move to the checkout. Compare the address bar on the cart and checkout.

Fix: Redirect all traffic to one address (one host name, https) that matches the WordPress Address and Site Address settings.

3. A cache or CDN is in front of the store#

A server cache or CDN that strips cookies from requests, or serves the cart and checkout from cache, means WooCommerce never sees the shopper’s session. This cause is outside WooCommerce, in the hosting or caching setup.

Check: Check your caching plugin, host and CDN settings for exclusions for cart, checkout, My account and the wp_woocommerce_session_ and woocommerce_items_in_cart cookies.

Fix: Exclude those pages from caching and let those cookies pass through, then clear every cache layer.

4. The session really did expire, or the customer logged out#

A guest who comes back to an open checkout tab more than two days later has no session left. Logging out ends the session and empties its cart, so a customer who logs out in one tab and then presses Place order in another sees this too. Expired sessions are also deleted from the database on a schedule.

Check: Ask the customer whether the page had been open a long time, or whether they logged out.

Fix: The customer adds the items again. Logged-in customers usually get their cart back when they log in, because WooCommerce keeps a copy on the account.

WooCommerce can only set its cookie before the page starts sending content. A stray space or line before <?php in a theme or plugin file, or a plugin that prints output too early, stops the cookie silently. With WP_DEBUG on, WooCommerce logs “cookie cannot be set – headers already sent by” with the file and line. If no customer can keep a cart, check this first.

Check: Turn on WP_DEBUG and WP_DEBUG_LOG, add a product to the cart, and read wp-content/debug.log.

Fix: Remove the output from the file and line named in the log.

6. A plugin clears the session or the cart#

Plugins can empty the restored session through woocommerce_restored_session_data, or empty the cart on certain pages. A plugin can also replace WooCommerce’s session storage entirely through woocommerce_session_handler, and then that plugin decides how long carts last. If the problem started after installing something, this is the likely reason.

Check: Use the Health Check & Troubleshooting plugin to turn off other plugins for your own session and repeat the purchase.

Fix: Change that plugin’s settings, or contact its developer.

Quick reference#

CauseHow to checkFix
The cart was emptied in another tabLook in WooCommerce > Orders for an order from the same customer placed just before.Nothing to fix if the order went through. Tell the customer their first order succeeded.
The session cookie isn't reaching the storeIn a private window, add a product and check in the browser's developer tools that a wp_woocommerce_session_ cookie exists and survives the move to the checkout. Compare the address bar on the cart and checkout.Redirect all traffic to one address (one host name, https) that matches the WordPress Address and Site Address settings.
A cache or CDN is in front of the storeCheck your caching plugin, host and CDN settings for exclusions for cart, checkout, My account and the wp_woocommerce_session_ and woocommerce_items_in_cart cookies.Exclude those pages from caching and let those cookies pass through, then clear every cache layer.
The session really did expire, or the customer logged outAsk the customer whether the page had been open a long time, or whether they logged out.The customer adds the items again. Logged-in customers usually get their cart back when they log in, because WooCommerce keeps a copy on the account.
The cookie can't be set because of early outputTurn on WP_DEBUG and WP_DEBUG_LOG, add a product to the cart, and read wp-content/debug.log.Remove the output from the file and line named in the log.
A plugin clears the session or the cartUse the Health Check & Troubleshooting plugin to turn off other plugins for your own session and repeat the purchase.Change that plugin's settings, or contact its developer.

Reproduced on a test store#

We set up each case below on a clean WooCommerce 11.2.1 store on 6 November 2026 and recorded exactly what it showed.

What we didWhat WooCommerce showed
Classic checkout. Logged out, add a product priced 10, open the checkout in tab 1. In tab 2, remove the item from the cart. In tab 1, press Place order.Sorry, your session has expired. Return to shop
Logged out, add a product, open the checkout in two tabs. Place the order in tab 1 with Direct bank transfer. In tab 2, press Place order.Sorry, your session has expired. Return to shop
Logged-in customer with a product in the cart, checkout open in tab 1. Log out in tab 2. Press Place order in tab 1.Sorry, your session has expired. Return to shop

For developers#

To see whether WooCommerce has a session on a given request, log WC()->session->get_customer_id() and WC()->session->has_session() early, for example on woocommerce_before_checkout_process. Session lifetimes can be lengthened with wc_session_expiration (and wc_session_expiring for when it renews); WooCommerce warns in its logs above 30 days. The refresh-time message can be suppressed with woocommerce_checkout_update_order_review_expired, but that only hides the symptom.

Where this lives in WooCommerce 11.2.1:

  • includes/class-wc-checkout.php, WC_Checkout::process_checkout: Throws the message when the checkout nonce fails and the cart is empty, or when the cart is empty after woocommerce_before_checkout_process.
  • includes/class-wc-ajax.php, WC_AJAX::update_order_review: When the cart is empty during a checkout refresh, replaces the checkout form with the message (filter woocommerce_checkout_update_order_review_expired).
  • includes/class-wc-session-handler.php, WC_Session_Handler::init_session_cookie: Restores the session from the wp_woocommerce_session_ cookie; destroys it if expired or if it belongs to a user who has logged out.
  • includes/class-wc-session-handler.php, WC_Session_Handler::set_session_expiration: Sessions last two days for guests and a week for logged-in customers by default (wc_session_expiration).
  • includes/class-wc-session-handler.php, WC_Session_Handler::forget_session: Clears the cookie and empties the cart; also runs on logout through destroy_session.
  • includes/wc-core-functions.php, wc_setcookie: Sets the cookie on COOKIE_DOMAIN and COOKIEPATH, and silently skips it if headers were already sent.

Back to the WooCommerce error reference.

Frequently asked questions#


How long does a WooCommerce cart last?

By default the session lasts two days for guests and seven days for logged-in customers. Developers can change it with the wc_session_expiration filter.


Was the customer's order placed?

Not by the attempt that showed this message. Check WooCommerce > Orders, because an earlier attempt in another tab may have succeeded.


Every customer gets this. What should I check first?

Whether the wp_woocommerce_session_ cookie is being set at all. Look for “headers already sent” in the debug log, and for caching in front of the checkout.


Why does the whole checkout form disappear and show this message?

The checkout refreshed its order summary after a field changed, found the cart empty, and replaced the form with the message.


Does the checkout block show this message?

No. The block checkout uses the Store API, which reports an empty cart as “Cannot place an order, your cart is empty.”


More in WooCommerce Errors

Keep exploring

All articles