“Clear all customer sessions” is a blunt WooCommerce tool. It empties active guest carts and may sign customers out of transactional flows. It can relieve a symptom, but it rarely explains why one session became stale or why sessions keep failing.
Start with the smallest recoverable scope: one test browser, one customer or rows already proven expired.
Decide whether the session is actually broken
Record the cart, account state, affected URL, timestamp and browser. Compare with a new private session and a second customer-safe test account.
If every visitor fails, the cause is more likely cache, database, cookie scope or application code than one corrupt session. If only one browser fails and a clean session works, targeted cleanup is reasonable.
Check orders and payments before clearing a checkout session; an uncertain transaction must be reconciled first.
Preserve diagnostic evidence
Inspect cookie domain, path, expiry and host transitions without recording cookie values. Note the matching server session’s expiry and size using authorised tools.
Preserve:
- affected route and exact time
- anonymous or customer session type
- cookie attributes, never its value
- relevant PHP/database error
- last action that changed the cart
Do not export serialised session contents unless strictly necessary and access-controlled; they may contain customer data.
Reset one browser session
For a single affected visitor, removing site data for the store in that browser creates a new guest session. Explain that their current cart may be lost and offer a way to record product names first.
Use browser controls for the exact site rather than clearing all browsing data. After reset, reproduce the original action and verify the new session persists.
If the defect returns immediately, stop clearing and investigate the root cause.
Handle a logged-in customer carefully
WooCommerce cart state can combine session data with persistent customer-cart data. Test whether logout/login restores an old cart or merges unexpected items.
Avoid deleting user metadata directly. Use WooCommerce-supported APIs or administration tools and back up relevant data before a targeted correction.
Confirm the customer’s identity through the business’s normal support process; session repair must not become an account-access shortcut.
Clean only expired server rows
If database growth is the issue, first restore WooCommerce scheduled cleanup and verify WP-Cron or server cron. Then remove rows that are objectively expired through supported maintenance.
A read-only count can establish scope:
SELECT COUNT(*) AS expired_rows
FROM wp_woocommerce_sessions
WHERE session_expiry < UNIX_TIMESTAMP();
Use the real table prefix. Take a backup before deletion and do not treat this query as authorisation to remove unexpired carts.
Avoid production-wide invalidation
Global session clearing may be justified after a security incident, incompatible session-schema change or explicit business decision, but it needs a maintenance window and customer-impact plan.
Document expected effects on carts, logins, coupons and abandoned-cart automation. Coordinate cache and deployment changes so customers do not rebuild sessions against mixed code versions.
Never run an unbounded database delete merely because the administrator button appears slow.
Fix why sessions break
Check canonical domain and HTTPS, cookie-consent classification, page-cache exclusions, object-cache consistency, database writes and custom cart code. In multi-node hosting, all nodes need compatible session/database access.
Match failures with disk, MySQL and PHP metrics. A cleanup that temporarily reduces table size will not repair a read-only database or bot-driven session flood.
Verify with active-session tests
Before maintenance, create controlled carts representing an unexpired guest and a customer. After targeted cleanup, confirm they remain intact where expected and the broken test session recovers.
Complete a guest order and verify one payment, stock and email. Monitor session counts and errors for several expiry cycles.
Recurring care should alert on cleanup backlog and abnormal growth. Targeted repair protects customer trust because it treats active carts as business data, not disposable cache.