Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Last active April 7, 2021 17:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/d17134dc83dd216555115182879da5f4 to your computer and use it in GitHub Desktop.
Save barryhughes/d17134dc83dd216555115182879da5f4 to your computer and use it in GitHub Desktop.
-- Delete WooCommerce session data for a specific user.
DELETE session_data,
session_meta
FROM wp_woocommerce_sessions AS session_data
JOIN wp_usermeta AS session_meta ON
session_meta.user_id = session_data.session_key
-- Set the `session_key` value to the target `user_id`.
WHERE session_key = 12345
AND (
meta_key = 'session_tokens'
OR meta_key LIKE '_woocommerce_persistent_cart_%'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment