Database Description
- Table Overview
-
Table Details
- Table:
woocommerce_sessions
- Table:
woocommerce_api_keys
- Table:
woocommerce_attribute_taxonomies
- Table:
woocommerce_downloadable_product_permissions
- Table:
woocommerce_order_items
- Table:
woocommerce_order_itemmeta
- Table:
woocommerce_tax_rates
- Table:
woocommerce_tax_rate_locations
- Table:
woocommerce_shipping_zones
- Table:
woocommerce_shipping_zone_locations
- Table:
woocommerce_shipping_zone_methods
- Table:
woocommerce_payment_tokens
- Table:
woocommerce_payment_tokenmeta
- Table:
woocommerce_log
- Table:
wc_webhooks
- Table:
wc_download_log
- Table:
wc_product_meta_lookup
- Table:
wc_tax_rate_classes
- Table:
- Source File
Since WooCommerce is a WordPress plugin, it makes use of many of the WordPress tables. Therefore, to understand the structure of WordPress, please see the WordPress Database Description doc.
Note that the posts tables is used by Custom Post Types, and WooCommerce uses those for products, coupons, and orders.
WooCommerce also adds some of its own custom tables. These are listed below.
The following tables are installed with WooCommerce. Please note, each table name will be prefixed with your WP Database Table Prefix e.g. wp_
.
Table Name | Description |
---|---|
actionscheduler_actions |
Stores information on actions that will be executed by Action Scheduler. |
actionscheduler_claims |
|
actionscheduler_groups |
|
actionscheduler_logs |
Logs Action Scheduler execution. |
woocommerce_sessions |
Stores customer session data, such as carts. |
woocommerce_api_keys |
Stores API Keys used for the REST API. |
woocommerce_attribute_taxonomies |
Stores global attribute taxonomy names for products. |
woocommerce_downloadable_product_permissions |
Stores product access permissions for downloadable products (granted after purchase). |
woocommerce_order_items |
Stores line items which are associated with orders. |
woocommerce_order_itemmeta |
Stores meta data about order line items. |
woocommerce_tax_rates |
Stores tax rates you define in the admin area. |
woocommerce_tax_rate_locations |
Stores locations (postcodes and cities) associated with the above tax rates. |
woocommerce_shipping_zones |
Stores shipping zones you create in the settings area. |
woocommerce_shipping_zone_locations |
Stores locations associated with your shipping zones. |
woocommerce_shipping_zone_methods |
Stores shipping methods linked to your shipping zones. |
woocommerce_payment_tokens |
Stores customer payment tokens (used by gateways). |
woocommerce_payment_tokenmeta |
Stores meta data about payment tokens. |
woocommerce_log |
General logging table (alternative to file based logging). |
wc_webhooks |
Stores any webhooks that have been setup on the store. |
wc_download_log |
Logs user downloads of downloadable products. |
wc_product_meta_lookup |
Lookup table that indexes order meta data to speed up requests. |
wc_tax_rate_classes |
Stores tax classes data. |
wc_reserved_stock |
Stores reserved stock and is used to prevent race conditions during checkout. |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
action_id |
bigint(20) unsigned |
Primary | Null | auto_increment | |
hook |
varchar(191) |
MUL | Null | ||
status |
varchar(20) |
MUL | Null | ||
scheduled_date_gmt |
datetime |
MUL | 0000-00-00 00:00:00 |
||
scheduled_date_local |
datetime |
0000-00-00 00:00:00 |
|||
args |
varchar(191) |
Yes | MUL | Null | |
schedule |
longtext |
Yes | Null | ||
group_id |
bigint(20) unsigned |
MUL | 0 | ||
attempts |
int(11) |
0 | |||
last_attempt_gmt |
datetime |
MUL | 0000-00-00 00:00:00 |
||
last_attempt_local |
datetime |
0000-00-00 00:00:00 |
|||
claim_id |
bigint(20) unsigned |
MUL | 0 | ||
extended_args |
varchar(8000) |
Yes | Null |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
claim_id |
bigint(20) unsigned |
Primary | Null | auto_increment | |
date_created_gmt |
datetime |
MUL | 0000-00-00 00:00:00 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
group_id |
bigint(20) unsigned |
Primary | Null | auto_increment | |
slug |
varchar(255) |
MUL | Null |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
log_id |
bigint(20) unsigned |
Primary | Null | auto_increment | |
action_id |
bigint(20) unsigned |
MUL | Null | ||
message |
text |
Null | |||
log_date_gmt |
datetime |
MUL | 0000-00-00 00:00:00 |
||
log_date_local |
datetime |
0000-00-00 00:00:00 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
session_id |
bigint(20) |
Unique | auto_increment | ||
session_key |
char(32) |
Primary | |||
session_value |
longtext |
||||
session_expiry |
bigint(20) |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
key_id |
bigint(20) |
Primary | auto_increment | ||
user_id |
bigint(20) |
||||
description |
longtext |
Yes | |||
permissions |
varchar(10) |
||||
consumer_key |
char(64) |
consumer_key |
|||
consumer_secret |
char(43) |
consumer_secret |
|||
nonces |
longtext |
Yes | |||
truncated_key |
char(7) |
||||
last_access |
datetime |
Yes | null |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
attribute_id |
bigint(20) |
Primary | auto_increment | ||
attribute_name |
varchar(200) |
attribute_name |
|||
attribute_label |
longtext |
Yes | |||
attribute_type |
varchar(200) |
||||
attribute_orderby |
varchar(200) |
||||
attribute_public |
int(1) |
1 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
permission_id |
bigint(20) |
Primary | auto_increment | ||
download_id |
varchar(32) |
download_order_product |
|||
product_id |
bigint(20) |
download_order_key_product , download_order_product
|
|||
order_id |
bigint(20) |
download_order_key_product , download_order_product
|
0 |
||
order_key |
varchar(200) |
download_order_key_product |
|||
user_email |
varchar(200) |
||||
user_id |
bigint(20) |
Yes | |||
downloads_remaining |
varchar(9) |
Yes | |||
access_granted |
datetime |
'0000-00-00 00:00:00' | |||
access_expires |
datetime |
Yes | null | ||
download_count |
bigint(20) |
0 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
order_item_id |
bigint(20) |
Primary | auto_increment | ||
order_item_name |
longtext |
||||
order_item_type |
varchar(200) |
`` | |||
order_id |
bigint(20) |
order_id |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
meta_id |
bigint(20) |
Primary | auto_increment | ||
order_item_id |
bigint(20) |
order_item_id |
|||
meta_key |
varchar(255) |
meta_key |
null | ||
meta_value |
longtext |
Yes |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
tax_rate_id |
bigint(20) |
Primary | auto_increment | ||
tax_rate_country |
varchar(200) |
tax_rate_country |
`` | ||
tax_rate_state |
varchar(200) |
tax_rate_state |
`` | ||
tax_rate |
varchar(200) |
`` | |||
tax_rate_name |
varchar(200) |
`` | |||
tax_rate_priority |
bigint(20) |
tax_rate_priority |
`` | ||
tax_rate_compound |
int(1) |
0 |
|||
tax_rate_shipping |
int(1) |
1 |
|||
tax_rate_order |
bigint(20) |
||||
tax_rate_class |
varchar(200) |
tax_rate_class |
`` |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
location_id |
bigint(20) |
Primary | auto_increment | ||
location_code |
varchar(255) |
location_type_code |
|||
tax_rate_id |
bigint(20) |
tax_rate_id |
|||
location_type |
varchar(40) |
location_type , location_type_code
|
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
zone_id |
bigint(20) |
Primary | auto_increment | ||
zone_name |
varchar(255) |
||||
zone_order |
bigint(20) |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
location_id |
bigint(20) |
Primary | auto_increment | ||
zone_id |
bigint(20) |
||||
location_code |
varchar(255) |
location_type_code |
|||
location_type |
varchar(40) |
location_type , location_type_code
|
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
zone_id |
bigint(20) |
||||
instance_id |
bigint(20) |
Primary | auto_increment | ||
method_id |
varchar(255) |
||||
method_order |
bigint(20) |
||||
is_enabled |
tinyint(1) |
1 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
token_id |
bigint(20) |
Primary | auto_increment | ||
gateway_id |
varchar(255) |
||||
token |
text |
||||
user_id |
bigint(20) |
user_id |
0 |
||
type |
varchar(255) |
||||
is_default |
tinyint(1) |
0 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
meta_id |
bigint(20) |
Primary | auto_increment | ||
payment_token_id |
bigint(20) |
payment_token_id |
|||
meta_key |
varchar(255) |
Yes | meta_key |
||
meta_value |
longtext |
Yes |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
log_id |
bigint(20) |
Primary | auto_increment | ||
timestamp |
datetime |
||||
level |
smallint(4) |
level |
|||
source |
varchar(200) |
||||
message |
longtext |
||||
context |
longtext |
Yes |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
webhook_id |
bigint(20) |
Primary | auto_increment | ||
status |
varchar(200) |
||||
name |
text |
||||
user_id |
bigint |
user_id |
|||
delivery_url |
text |
||||
secret |
text |
Yes | |||
topic |
varchar(200) |
Yes | |||
date_created |
datetime |
Yes | 0000-00-00 00:00:00 |
||
date_created_gmt |
datetime |
Yes | 0000-00-00 00:00:00 |
||
date_modified |
datetime |
Yes | 0000-00-00 00:00:00 |
||
date_modified_gmt |
datetime |
Yes | 0000-00-00 00:00:00 |
||
api_version |
smallint(4) |
Yes | |||
failure_count |
smallint(10) |
Yes | |||
pending_delivery |
tinyint(1) |
Yes |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
download_log_id |
bigint(20) |
Primary | auto_increment | ||
timestamp |
datetime |
timestamp |
|||
permission_id |
bigint(20) |
permission_id |
|||
user_id |
bigint(20) |
Yes | |||
user_ip_address |
varchar(100) |
Yes |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
product_id |
bigint(20) |
Primary | |||
sku |
varchar(100) |
Yes | Empty string | ||
virtual |
tinyint(1) |
Yes | virtual |
0 | |
downloadable |
tinyint(1) |
Yes | downloadable |
0 | |
min_price |
decimal(10,2) |
Yes | min_max_price |
Null | |
max_price |
decimal(10,2) |
Yes | min_max_price |
Null | |
onsale |
tinyint(1) |
Yes | onsale |
0 | |
stock_quantity |
double |
Yes | stock_quantity |
Null | |
stock_status |
varchar(100) |
Yes | stock_status |
'instock' | |
rating_count |
bigint(20) |
Yes | 0 | ||
average_rating |
decimal(3,2) |
Yes | 0.00 | ||
total_sales |
bigint(20) |
Yes | 0 |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
tax_rate_class_id |
bigint |
Primary | auto_increment | ||
name |
varchar(200) |
||||
slug |
varchar(200) |
slug |
Field | Type | Null | Key | Default | Extra |
---|---|---|---|---|---|
order_id |
bigint(20) |
Primary | Null | ||
product_id |
bigint(20) |
Primary | Null | ||
stock_quantity |
double |
0 | |||
timestamp |
datetime |
0000-00-00 00:00:00 |
|||
expires |
datetime |
0000-00-00 00:00:00 |
The database scheme is defined in includes/class-wc-install.php
WooCommerce is an open source commerce platform built for WordPress and lovingly crafted by Automattic and the WooCommerce community 💜. Come and work with us!
Contribution
- Set up development environment
- Our Git Flow
- SCSS and JS minification
- Naming conventions
- CSS SASS coding guidelines and naming conventions
- Critical Flows
- API Critical Flows
- String localisation guidelines
- Translating WooCommerce
- Deprecation in core
- Adding Actions and Filters
- Common Issues
- Writing high-quality testing instructions
Release Notes
- Release Testing Instructions
- 3.6.x notes/FAQ
- 2.6.x to 3.0.0 Developer Migration Notes
- Select2 fields not working in 3.0.x
- Thumbnail Image Regeneration in 3.3+
- Customizing image sizes in 3.3+
REST API and CLI
CRUD & Data Descriptions
- Database Description
- CRUD Objects in 3.0
- Order and Order Line Item Data
- Coupon Data
- Customer Data
- Product Data
- Data Stores
Internal APIs
Theming
- Enabling product gallery features (zoom, swipe, lightbox)
- Template File Guidelines for Devs and Theme Authors
Examples / Guides