Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SQL query to delete expired WooCommerce Sessions.
delete from t1, t2
using wp_options t1
join wp_options t2 on t2.option_name = replace(t1.option_name, '_expires', '')
where (t1.option_name like '\_wc\_session\_expires\_%')
and t1.option_value < UNIX_TIMESTAMP(NOW())
Copy link

nathanielks commented Sep 29, 2016

Be sure to update wp_ to whatever the prefix is for your database. This deletes all expired sessions in your options table. Doesn't touch the wc_sessions table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment