wp_woocommerce_sessions
StaticStores session data for tracking user or visitor state.
Column Definitions
| Column | Type | Nullable |
|---|---|---|
| 🔑session_id | bigint(20) unsigned | NO |
| session_key | char(32) | NO |
| session_value | longtext | NO |
| session_expiry | bigint(20) unsigned | NO |
| user_id | bigint(20) unsigned | NO |
| description | varchar(200) | YES |
| permissions | varchar(10) | NO |
| consumer_key | char(64) | NO |
| consumer_secret | char(43) | NO |
| nonces | longtext | YES |
| truncated_key | char(7) | NO |
| last_access | datetime | YES |
| attribute_name | varchar(200) | NO |
| attribute_label | varchar(200) | YES |
| attribute_type | varchar(20) | NO |
| attribute_orderby | varchar(20) | NO |
| attribute_public | int(1) | NO |
| download_id | varchar(36) | NO |
| product_id | bigint(20) unsigned | NO |
| order_id | bigint(20) unsigned | NO |
| order_key | varchar(200) | NO |
| user_email | varchar(200) | NO |
| user_id | bigint(20) unsigned | YES |
| downloads_remaining | varchar(9) | YES |
| access_granted | datetime | NO |
| access_expires | datetime | YES |
| download_count | bigint(20) unsigned | NO |
| order_item_name | text | NO |
| order_item_type | varchar(200) | NO |
| order_id | bigint(20) unsigned | NO |
| order_item_id | bigint(20) unsigned | NO |
| meta_key | varchar(255) | YES |
| meta_value | longtext | YES |
| tax_rate_country | varchar(2) | NO |
| tax_rate_state | varchar(200) | NO |
| tax_rate | varchar(8) | NO |
| tax_rate_name | varchar(200) | NO |
| tax_rate_priority | bigint(20) unsigned | NO |
| tax_rate_compound | int(1) | NO |
| tax_rate_shipping | int(1) | NO |
| tax_rate_order | bigint(20) unsigned | NO |
| tax_rate_class | varchar(200) | NO |
| location_code | varchar(200) | NO |
| tax_rate_id | bigint(20) unsigned | NO |
| location_type | varchar(40) | NO |
| zone_name | varchar(200) | NO |
| zone_order | bigint(20) unsigned | NO |
| zone_id | bigint(20) unsigned | NO |
| location_code | varchar(200) | NO |
| location_type | varchar(40) | NO |
| 🔑instance_id | bigint(20) unsigned | NO |
| method_id | varchar(200) | NO |
| method_order | bigint(20) unsigned | NO |
| is_enabled | tinyint(1) | NO |
| gateway_id | varchar(200) | NO |
| token | text | NO |
| user_id | bigint(20) unsigned | NO |
| type | varchar(200) | NO |
| is_default | tinyint(1) | NO |
| payment_token_id | bigint(20) unsigned | NO |
| meta_key | varchar(255) | YES |
| meta_value | longtext | YES |
| timestamp | datetime | NO |
| level | smallint(4) | NO |
| source | varchar(200) | NO |
| message | longtext | NO |
| context | longtext | YES |
| status | varchar(200) | NO |
| name | text | NO |
| user_id | bigint(20) unsigned | NO |
| delivery_url | text | NO |
| secret | text | NO |
| topic | varchar(200) | NO |
| date_created | datetime | NO |
| date_created_gmt | datetime | NO |
| date_modified | datetime | NO |
| date_modified_gmt | datetime | NO |
| api_version | smallint(4) | NO |
| failure_count | smallint(10) | NO |
| pending_delivery | tinyint(1) | NO |
| timestamp | datetime | NO |
| permission_id | bigint(20) unsigned | NO |
| user_id | bigint(20) unsigned | YES |
| user_ip_address | varchar(100) | YES |
| sku | varchar(100) | YES |
| global_unique_id | varchar(100) | YES |
| virtual | tinyint(1) | YES |
| downloadable | tinyint(1) | YES |
| min_price | decimal(19,4) | YES |
| max_price | decimal(19,4) | YES |
| onsale | tinyint(1) | YES |
| stock_quantity | double | YES |
| stock_status | varchar(100) | YES |
| rating_count | bigint(20) | YES |
| average_rating | decimal(3,2) | YES |
| total_sales | bigint(20) | YES |
| tax_status | varchar(100) | YES |
| tax_class | varchar(100) | YES |
| name | varchar(200) | NO |
| slug | varchar(200) | NO |
| product_id | bigint(20) | NO |
| stock_quantity | double | NO |
| timestamp | datetime | NO |
| expires | datetime | NO |
| rate_limit_key | varchar(200) | NO |
| rate_limit_expiry | bigint(20) unsigned | NO |
| rate_limit_remaining | smallint(10) | NO |
| url | varchar(256) | NO |
| enabled | tinyint(1) | NO |
| order_id | bigint(20) unsigned | NO |
| product_id | bigint(20) unsigned | NO |
| variation_id | bigint(20) unsigned | NO |
| customer_id | bigint(20) unsigned | YES |
| date_created | datetime | NO |
| product_qty | int(11) | NO |
| product_net_revenue | double | NO |
| product_gross_revenue | double | NO |
| coupon_amount | double | NO |
| tax_amount | double | NO |
| shipping_amount | double | NO |
| shipping_tax_amount | double | NO |
| tax_rate_id | bigint(20) unsigned | NO |
| order_item_id | bigint(20) unsigned | NO |
| date_created | datetime | NO |
| shipping_tax | double | NO |
| order_tax | double | NO |
| total_tax | double | NO |
| taxable_amount | double | NO |
| coupon_id | bigint(20) | NO |
| date_created | datetime | NO |
| discount_amount | double | NO |
| name | varchar(255) | NO |
| type | varchar(20) | NO |
| locale | varchar(20) | NO |
| title | longtext | NO |
| content | longtext | NO |
| content_data | longtext | YES |
| status | varchar(200) | NO |
| source | varchar(200) | NO |
| date_created | datetime | NO |
| date_reminder | datetime | YES |
| is_snoozable | tinyint(1) | NO |
| layout | varchar(20) | NO |
| image | varchar(200) | YES |
| is_deleted | tinyint(1) | NO |
| is_read | tinyint(1) | NO |
| icon | varchar(200) | NO |
| note_id | bigint(20) unsigned | NO |
| name | varchar(255) | NO |
| label | varchar(255) | NO |
| query | longtext | NO |
| status | varchar(255) | NO |
| actioned_text | varchar(255) | NO |
| nonce_action | varchar(255) | YES |
| nonce_name | varchar(255) | YES |
| user_id | bigint(20) unsigned | YES |
| username | varchar(60) | NO |
| first_name | varchar(255) | NO |
| last_name | varchar(255) | NO |
| varchar(100) | YES | |
| date_last_active | timestamp | YES |
| date_registered | timestamp | YES |
| country | char(2) | NO |
| postcode | varchar(20) | NO |
| city | varchar(100) | NO |
| state | varchar(100) | NO |
| billing_phone | varchar(100) | NO |
| shipping_phone | varchar(100) | NO |
| category_id | bigint(20) unsigned | NO |
CREATE TABLE Statement
CREATE TABLE wp_woocommerce_sessions ( session_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, session_key char(32) NOT NULL, session_value longtext NOT NULL, session_expiry bigint(20) unsigned NOT NULL, PRIMARY KEY (session_id), KEY session_expiry (session_expiry), UNIQUE KEY session_key (session_key) ) $collate; CREATE TABLE wp_woocommerce_api_keys ( key_id bigint(20) unsigned NOT NULL auto_increment, user_id bigint(20) unsigned NOT NULL, description varchar(200) NULL, permissions varchar(10) NOT NULL, consumer_key char(64) NOT NULL, consumer_secret char(43) NOT NULL, nonces longtext NULL, truncated_key char(7) NOT NULL, last_access datetime NULL default null, PRIMARY KEY (key_id), KEY consumer_key (consumer_key), KEY consumer_secret (consumer_secret) ) $collate; CREATE TABLE wp_woocommerce_attribute_taxonomies ( attribute_id bigint(20) unsigned NOT NULL auto_increment, attribute_name varchar(200) NOT NULL, attribute_label varchar(200) NULL, attribute_type varchar(20) NOT NULL, attribute_orderby varchar(20) NOT NULL, attribute_public int(1) NOT NULL DEFAULT 1, PRIMARY KEY (attribute_id), KEY attribute_name (attribute_name(20)) ) $collate; CREATE TABLE wp_woocommerce_downloadable_product_permissions ( permission_id bigint(20) unsigned NOT NULL auto_increment, download_id varchar(36) NOT NULL, product_id bigint(20) unsigned NOT NULL, order_id bigint(20) unsigned NOT NULL DEFAULT 0, order_key varchar(200) NOT NULL, user_email varchar(200) NOT NULL, user_id bigint(20) unsigned NULL, downloads_remaining varchar(9) NULL, access_granted datetime NOT NULL default '0000-00-00 00:00:00', access_expires datetime NULL default null, download_count bigint(20) unsigned NOT NULL DEFAULT 0, PRIMARY KEY (permission_id), KEY download_order_key_product (product_id,order_id,order_key(16),download_id), KEY download_order_product (download_id,order_id,product_id), KEY order_id (order_id), KEY user_order_remaining_expires (user_id,order_id,downloads_remaining,access_expires), KEY idx_user_email (user_email(100)) ) $collate; CREATE TABLE wp_woocommerce_order_items ( order_item_id bigint(20) unsigned NOT NULL auto_increment, order_item_name text NOT NULL, order_item_type varchar(200) NOT NULL DEFAULT '', order_id bigint(20) unsigned NOT NULL, PRIMARY KEY (order_item_id), KEY order_id (order_id) ) $collate; CREATE TABLE wp_woocommerce_order_itemmeta ( meta_id bigint(20) unsigned NOT NULL auto_increment, order_item_id bigint(20) unsigned NOT NULL, meta_key varchar(255) default NULL, meta_value longtext NULL, PRIMARY KEY (meta_id), KEY order_item_id (order_item_id), KEY meta_key (meta_key(32)) ) $collate; CREATE TABLE wp_woocommerce_tax_rates ( tax_rate_id bigint(20) unsigned NOT NULL auto_increment, tax_rate_country varchar(2) NOT NULL DEFAULT '', tax_rate_state varchar(200) NOT NULL DEFAULT '', tax_rate varchar(8) NOT NULL DEFAULT '', tax_rate_name varchar(200) NOT NULL DEFAULT '', tax_rate_priority bigint(20) unsigned NOT NULL, tax_rate_compound int(1) NOT NULL DEFAULT 0, tax_rate_shipping int(1) NOT NULL DEFAULT 1, tax_rate_order bigint(20) unsigned NOT NULL, tax_rate_class varchar(200) NOT NULL DEFAULT '', PRIMARY KEY (tax_rate_id), KEY tax_rate_country (tax_rate_country), KEY tax_rate_state (tax_rate_state(2)), KEY tax_rate_class (tax_rate_class(10)), KEY tax_rate_priority (tax_rate_priority) ) $collate; CREATE TABLE wp_woocommerce_tax_rate_locations ( location_id bigint(20) unsigned NOT NULL auto_increment, location_code varchar(200) NOT NULL, tax_rate_id bigint(20) unsigned NOT NULL, location_type varchar(40) NOT NULL, PRIMARY KEY (location_id), KEY tax_rate_id (tax_rate_id), KEY location_type_code (location_type(10),location_code(20)) ) $collate; CREATE TABLE wp_woocommerce_shipping_zones ( zone_id bigint(20) unsigned NOT NULL auto_increment, zone_name varchar(200) NOT NULL, zone_order bigint(20) unsigned NOT NULL, PRIMARY KEY (zone_id), KEY zone_order_id (zone_order, zone_id) ) $collate; CREATE TABLE wp_woocommerce_shipping_zone_locations ( location_id bigint(20) unsigned NOT NULL auto_increment, zone_id bigint(20) unsigned NOT NULL, location_code varchar(200) NOT NULL, location_type varchar(40) NOT NULL, PRIMARY KEY (location_id), KEY zone_id (zone_id), KEY location_type_code (location_type(10),location_code(20)) ) $collate; CREATE TABLE wp_woocommerce_shipping_zone_methods ( zone_id bigint(20) unsigned NOT NULL, instance_id bigint(20) unsigned NOT NULL auto_increment, method_id varchar(200) NOT NULL, method_order bigint(20) unsigned NOT NULL, is_enabled tinyint(1) NOT NULL DEFAULT '1', PRIMARY KEY (instance_id), KEY zone_id (zone_id), KEY method_id (method_id(20)) ) $collate; CREATE TABLE wp_woocommerce_payment_tokens ( token_id bigint(20) unsigned NOT NULL auto_increment, gateway_id varchar(200) NOT NULL, token text NOT NULL, user_id bigint(20) unsigned NOT NULL DEFAULT '0', type varchar(200) NOT NULL, is_default tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (token_id), KEY user_id (user_id) ) $collate; CREATE TABLE wp_woocommerce_payment_tokenmeta ( meta_id bigint(20) unsigned NOT NULL auto_increment, payment_token_id bigint(20) unsigned NOT NULL, meta_key varchar(255) NULL, meta_value longtext NULL, PRIMARY KEY (meta_id), KEY payment_token_id (payment_token_id), KEY meta_key (meta_key(32)) ) $collate; CREATE TABLE wp_woocommerce_log ( log_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, timestamp datetime NOT NULL, level smallint(4) NOT NULL, source varchar(200) NOT NULL, message longtext NOT NULL, context longtext NULL, PRIMARY KEY (log_id), KEY level (level) ) $collate; CREATE TABLE wp_wc_webhooks ( webhook_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, status varchar(200) NOT NULL, name text NOT NULL, user_id bigint(20) unsigned NOT NULL, delivery_url text NOT NULL, secret text NOT NULL, topic varchar(200) NOT NULL, date_created datetime NOT NULL DEFAULT '0000-00-00 00:00:00', date_created_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00', date_modified datetime NOT NULL DEFAULT '0000-00-00 00:00:00', date_modified_gmt datetime NOT NULL DEFAULT '0000-00-00 00:00:00', api_version smallint(4) NOT NULL, failure_count smallint(10) NOT NULL DEFAULT '0', pending_delivery tinyint(1) NOT NULL DEFAULT '0', PRIMARY KEY (webhook_id), KEY user_id (user_id) ) $collate; CREATE TABLE wp_wc_download_log ( download_log_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, timestamp datetime NOT NULL, permission_id bigint(20) unsigned NOT NULL, user_id bigint(20) unsigned NULL, user_ip_address varchar(100) NULL DEFAULT '', PRIMARY KEY (download_log_id), KEY permission_id (permission_id), KEY timestamp (timestamp) ) $collate; CREATE TABLE wp_wc_product_meta_lookup ( `product_id` bigint(20) NOT NULL, `sku` varchar(100) NULL default '', `global_unique_id` varchar(100) NULL default '', `virtual` tinyint(1) NULL default 0, `downloadable` tinyint(1) NULL default 0, `min_price` decimal(19,4) NULL default NULL, `max_price` decimal(19,4) NULL default NULL, `onsale` tinyint(1) NULL default 0, `stock_quantity` double NULL default NULL, `stock_status` varchar(100) NULL default 'instock', `rating_count` bigint(20) NULL default 0, `average_rating` decimal(3,2) NULL default 0.00, `total_sales` bigint(20) NULL default 0, `tax_status` varchar(100) NULL default 'taxable', `tax_class` varchar(100) NULL default '', PRIMARY KEY (`product_id`), KEY `virtual` (`virtual`), KEY `downloadable` (`downloadable`), KEY `stock_status` (`stock_status`), KEY `stock_quantity` (`stock_quantity`), KEY `onsale` (`onsale`), KEY min_max_price (`min_price`, `max_price`), KEY sku (sku(50)), KEY global_unique_id (global_unique_id(50)) ) $collate; CREATE TABLE wp_wc_tax_rate_classes ( tax_rate_class_id bigint(20) unsigned NOT NULL auto_increment, name varchar(200) NOT NULL DEFAULT '', slug varchar(200) NOT NULL DEFAULT '', PRIMARY KEY (tax_rate_class_id), UNIQUE KEY slug (slug($max_index_length)) ) $collate; CREATE TABLE wp_wc_reserved_stock ( `order_id` bigint(20) NOT NULL, `product_id` bigint(20) NOT NULL, `stock_quantity` double NOT NULL DEFAULT 0, `timestamp` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', `expires` datetime NOT NULL DEFAULT '0000-00-00 00:00:00', PRIMARY KEY (`order_id`, `product_id`), KEY product_id_expires (product_id, expires) ) $collate; CREATE TABLE wp_wc_rate_limits ( rate_limit_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, rate_limit_key varchar(200) NOT NULL, rate_limit_expiry bigint(20) unsigned NOT NULL, rate_limit_remaining smallint(10) NOT NULL DEFAULT '0', PRIMARY KEY (rate_limit_id), UNIQUE KEY rate_limit_key (rate_limit_key($max_index_length)) ) $collate; $product_attributes_lookup_table_creation_sql CREATE TABLE wp_wc_product_download_directories ( url_id bigint(20) unsigned NOT NULL auto_increment, url varchar(256) NOT NULL, enabled tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (url_id), KEY url (url($max_index_length)) ) $collate; $order_stats_table_schema CREATE TABLE wp_wc_order_product_lookup ( order_item_id bigint(20) unsigned NOT NULL, order_id bigint(20) unsigned NOT NULL, product_id bigint(20) unsigned NOT NULL, variation_id bigint(20) unsigned NOT NULL, customer_id bigint(20) unsigned NULL, date_created datetime $datetime_default NOT NULL, product_qty int(11) NOT NULL, product_net_revenue double DEFAULT 0 NOT NULL, product_gross_revenue double DEFAULT 0 NOT NULL, coupon_amount double DEFAULT 0 NOT NULL, tax_amount double DEFAULT 0 NOT NULL, shipping_amount double DEFAULT 0 NOT NULL, shipping_tax_amount double DEFAULT 0 NOT NULL, PRIMARY KEY (order_item_id, order_id), KEY order_id (order_id), KEY product_id (product_id), KEY customer_id (customer_id), KEY date_created (date_created), KEY customer_product_date (customer_id, product_id, date_created) ) $collate; CREATE TABLE wp_wc_order_tax_lookup ( order_id bigint(20) unsigned NOT NULL, tax_rate_id bigint(20) unsigned NOT NULL, order_item_id bigint(20) unsigned NOT NULL DEFAULT 0, date_created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, shipping_tax double DEFAULT 0 NOT NULL, order_tax double DEFAULT 0 NOT NULL, total_tax double DEFAULT 0 NOT NULL, taxable_amount double DEFAULT 0 NOT NULL, PRIMARY KEY (order_id, tax_rate_id, order_item_id), KEY tax_rate_id (tax_rate_id), KEY date_created (date_created) ) $collate; CREATE TABLE wp_wc_order_coupon_lookup ( order_id bigint(20) unsigned NOT NULL, coupon_id bigint(20) NOT NULL, date_created datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, discount_amount double DEFAULT 0 NOT NULL, PRIMARY KEY (order_id, coupon_id), KEY coupon_id (coupon_id), KEY date_created (date_created) ) $collate; CREATE TABLE wp_wc_admin_notes ( note_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, name varchar(255) NOT NULL, type varchar(20) NOT NULL, locale varchar(20) NOT NULL, title longtext NOT NULL, content longtext NOT NULL, content_data longtext NULL default null, status varchar(200) NOT NULL, source varchar(200) NOT NULL, date_created datetime NOT NULL default '0000-00-00 00:00:00', date_reminder datetime NULL default null, is_snoozable tinyint(1) DEFAULT 0 NOT NULL, layout varchar(20) DEFAULT '' NOT NULL, image varchar(200) NULL DEFAULT NULL, is_deleted tinyint(1) DEFAULT 0 NOT NULL, is_read tinyint(1) DEFAULT 0 NOT NULL, icon varchar(200) NOT NULL default 'info', PRIMARY KEY (note_id) ) $collate; CREATE TABLE wp_wc_admin_note_actions ( action_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, note_id bigint(20) unsigned NOT NULL, name varchar(255) NOT NULL, label varchar(255) NOT NULL, query longtext NOT NULL, status varchar(255) NOT NULL, actioned_text varchar(255) NOT NULL, nonce_action varchar(255) NULL DEFAULT NULL, nonce_name varchar(255) NULL DEFAULT NULL, PRIMARY KEY (action_id), KEY note_id (note_id) ) $collate; CREATE TABLE wp_wc_customer_lookup ( customer_id bigint(20) unsigned NOT NULL AUTO_INCREMENT, user_id bigint(20) unsigned DEFAULT NULL, username varchar(60) DEFAULT '' NOT NULL, first_name varchar(255) NOT NULL, last_name varchar(255) NOT NULL, email varchar(100) NULL default NULL, date_last_active timestamp NULL default null, date_registered timestamp NULL default null, country char(2) DEFAULT '' NOT NULL, postcode varchar(20) DEFAULT '' NOT NULL, city varchar(100) DEFAULT '' NOT NULL, state varchar(100) DEFAULT '' NOT NULL, billing_phone varchar(100) DEFAULT '' NOT NULL, shipping_phone varchar(100) DEFAULT '' NOT NULL, PRIMARY KEY (customer_id), UNIQUE KEY user_id (user_id), KEY email (email) ) $collate; CREATE TABLE wp_wc_category_lookup ( category_tree_id bigint(20) unsigned NOT NULL, category_id bigint(20) unsigned NOT NULL, PRIMARY KEY (category_tree_id,category_id) ) $collate; $hpos_table_schema; $stock_notifications_table_schema; "; return $tables; } /** * Return a list of WooCommerce tables. Used to make sure all WC tables are dropped when uninstalling the plugin * in a single site or multi site environment. * * @return array WC tables. */ public static function get_tables() { global $wpdb; $tables = array( "wp_wc_download_log", "wp_wc_product_download_directories", "wp_wc_product_meta_lookup", "wp_wc_tax_rate_classes", "wp_wc_webhooks", "wp_woocommerce_api_keys", "wp_woocommerce_attribute_taxonomies", "wp_woocommerce_downloadable_product_permissions", "wp_woocommerce_log", "wp_woocommerce_order_itemmeta", "wp_woocommerce_order_items", "wp_woocommerce_payment_tokenmeta", "wp_woocommerce_payment_tokens", "wp_woocommerce_sessions", "wp_woocommerce_shipping_zone_locations", "wp_woocommerce_shipping_zone_methods", "wp_woocommerce_shipping_zones", "wp_woocommerce_tax_rate_locations", "wp_woocommerce_tax_rates", "wp_wc_reserved_stock", "wp_wc_rate_limits", "wp_wc_product_attributes_lookup", "wp_wc_stock_notifications", "wp_wc_stock_notificationmeta", /* * No longer created: the abandoned cart recovery feature that owned this table was * removed in 11.2.0. It stays listed here so that a site which uninstalls before the * removal migration has run is not left with an orphaned table. */ "wp_wc_email_unsubscribes", // WCA Tables. "wp_wc_order_stats", "wp_wc_order_product_lookup", "wp_wc_order_tax_lookup", "wp_wc_order_coupon_lookup", "wp_wc_admin_notes", "wp_wc_admin_note_actions", "wp_wc_customer_lookup", "wp_wc_category_lookup", "wp_wc_order_fulfillments", "wp_wc_order_fulfillment_meta", // HPOS. "wp_wc_orders", "wp_wc_order_addresses", "wp_wc_order_operational_data", "wp_wc_orders_meta", );Safe to delete?
If you have uninstalled WooCommerce, this table is generally safe to remove. However, always back up your database first.
Note: Some plugins share tables or are dependencies of other plugins. Verify nothing else depends on this table before dropping it.
How to remove this table
DROP TABLE IF EXISTS `wp_woocommerce_sessions`;
Run this query using phpMyAdmin, Adminer, or your MySQL client. Back up first.
Other tables from WooCommerce