Support » Plugin: WooCommerce » Can't Clear User Sessions – 500,000 Rows Of wc_sessions in wp_options

  • Hello –

    Site: removed

    I’m currently experiencing a major issue with one of the sites I oversee. The database is showing me well over 500,000 rows of data in wp_options relating to user sessions – and steadily increasing. They all look like this:

    1497764 – _wc_session_expires_77d5db54437b75217b1f86c15dfe9b

    There are hundreds of thousands of these rows.

    I have attempted to clear all user sessions by navigating to the WooCommerce setting WooCommerce > System Status > Tools > Clear All Sessions (Customer Sessions) but apparently this does nothing as I refresh my phpMyAdmin backend and I still see all rows still there, the number (529k at this time) is still the same.

    I am not sure if I should go page by page within phpMyAdmin and delete them, or what. I don’t want to delete something that actually is important accidentally.

    If anyone has any idea what to do please advise. Thank you.

    ### WordPress Environment ###
    Home URL: removed
    Site URL: removed
    WC Version: 2.5.5
    Log Directory Writable: ✔
    WP Version: 4.5.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    Language: en_US
    ### Server Environment ###
    Server Info: Apache
    PHP Version: 5.4.43
    PHP Post Max Size: 64 MB
    PHP Time Limit: 30
    PHP Max Input Vars: 1000
    SUHOSIN Installed: –
    MySQL Version: 5.5.42
    Max Upload Size: 64 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    ### Database ###
    WC Database Version: 2.5.5
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_termmeta: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    ### Settings ###
    Force SSL: ✔
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    ### API ###
    API Enabled: ✔
    API Version: 3.1.0
    ### WC Pages ###
    Shop Base: #89 - /shop/
    Cart: #90 - /cart/
    Checkout: #91 - /checkout/
    My Account: #92 - /my-account/
    ### Taxonomies ###
    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    ### Theme ###
    Name: Storefront USS
    Version: 1.0.0
    Author URL:
    Child Theme: ✔
    Parent Theme Name: Storefront
    Parent Theme Version: 1.6.1 – 2.0.1 is available
    Parent Theme Author URL:
    WooCommerce Support: ✔
    ### Templates ###
    Overrides: storefront-uss/woocommerce/checkout/form-checkout.php
    ### AIM ###
    Environment: Production

Viewing 7 replies - 1 through 7 (of 7 total)
  • Update: I have tried to MANUALLY delete the _wc_session rows from my database using the guide outlined here:

    However – The database entries still remain. It stated at the end of the process that 543,496 rows were deleted (Query took 28.8822 seconds), but when I access phpMyAdmin the row count is still over 500k and the entries for _wc_session still remain.

    I am at a loss. I have no idea why this is happening.

    UPDATE: The rows are now gone, but the count (500k) still remains. I am not sure why this is.

    Plugin Author Mike Jolley


    WooCommerce 2.5 does not store sessions in the options table. Once removed, they are gone for good.



    @mikejolley Mike, his version is 2.5.5 though (shown in OP)… according to the WooCommerce blog post here, the session data should be storing in the wp_woocommerce_sessions table and not the wp_options table, correct? Why is his wp_options table receiving the data meant for the wp_woocommerce_sessions table?

    I ask, because I manage a site experiencing the same behavior. Our site does leverage some extra session coding, but if our issues are identical, it could be a bug somewhere. We are running v2.6.4, so it shouldn’t be storing any session data in wp_options… at least that’s what I’ve been lead to believe.

    Plugin Author Mike Jolley


    If you’re on an install with the new table, the old table (options) is not even written to by core for sessions. So that would mean either something else is writing them, or you’re not on a version with the new table.



    We have the new table (wp_woocommerce_sessions), but it is only storing SOME data. We are using wp_session for our other session coding, so I’m guessing that’s where the issue is.




    @kbrownatp – Has this issue been resolved for you? Inspecting my database now only shows 5k rows – it seems like this issue may be resolved for the most part, still not sure how it started though.



    @bluetower, yes we resolved it by using the Woo session handler(which uses WP Session manager), instead of our own WP Session Manager plugin, that uses the built-in “add_option” functions. Those functions write the data to the wp_options (obvious once you look at the code) table instead of the wp_woocommerce_sessions table.

    After re-coding everything to use the woo session handler, data is going to the woo session table as desired.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Can't Clear User Sessions – 500,000 Rows Of wc_sessions in wp_options’ is closed to new replies.