Woocommerce Bulk WP_Options Session & Transient

WP_Options is the table where woocommerce saved their transients and sessions of the customer’s activity(cart,wishlist,etc). So along the time it will get bulky in the cases i had seen it’s over than 1 gigabyte and it isn’t normal for me.

We can delete the transients and sessions through menu wp-admin => woocommerce => system status => tab Tools. You can clear transients, clear expired transients and clear all sessions. Sometimes when the data got that big you will encounter a timeout while doing it so you have to do it manually from the database.

Go to phpmyadmin => WP database => table wp_options. We gonna run below query


DELETE FROM wp_options WHERE option_name LIKE '_wc_session_%' OR option_name LIKE '_wc_session_expires_%';
DELETE FROM wp_options WHERE option_name LIKE '_transient_%' OR option_name LIKE '_site_transient_%';

After run the query try to browse wp_options and see your last row, if you encounter empty row try go to menu Operations and click “Optimize table”. Try to browse again wp_options and see your last row, it will appears normally.

Check your wp-config.php and look for “define(‘DISABLE_WP_CRON’, ‘true’);” and it’s there try to set it to “false” or comment the line.

Put the code below to robots.txt to avoid bots crawling add to cart and creating sessons


User-agent: *
Disallow: /*add-to-cart=*

Leave a Reply

Your email address will not be published. Required fields are marked *