WooCommerce Database Structure: Understanding All WooCommerce Database Tables and What They Store
WooCommerce integrates deeply with WordPress, using both its core database tables and a set of custom tables to manage everything from products and orders to customer data and store configurations. When you activate the WooCommerce plugin, it creates 38 tables in the database Let’s break down each table and what it stores, so you can understand WooCommerce’s data organization more fully.
WordPress Core Tables Used by WooCommerce
WooCommerce uses WordPress’s core tables to manage its custom post types, users, and taxonomies. Here’s how it works:
wp_posts
- Stores WooCommerce products (
post_type = 'product'), orders (post_type = 'shop_order'), and coupons (post_type = 'shop_coupon'). Each item has its own row inwp_posts, storing data such as titles, descriptions, and timestamps.
wp_postmeta
- Stores metadata for WooCommerce products, orders, and coupons. Each piece of additional information (e.g., product attributes, prices, order statuses) is saved as a key-value pair.
wp_terms
- Used for product categories, tags, and custom attributes. Each term, such as a category name, is stored in this table.
wp_term_taxonomy
- Defines the type of taxonomy for each term in
wp_terms, such as a product category or tag.
wp_term_relationships
- Links terms (categories, tags) with specific products by creating relationships between the
wp_postsandwp_termstables.
wp_users
- Stores customer account information, including usernames, passwords, and email addresses for registered users.
wp_usermeta
- Stores additional customer data like billing and shipping addresses, WooCommerce roles, and custom user data for registered users.
wp_options
- Contains various WooCommerce settings and configurations, such as currency, tax options, and default product settings. WooCommerce stores many of its core settings here.
WooCommerce Custom Tables
To manage specific e-commerce data, WooCommerce adds several custom tables. These tables allow efficient storage and retrieval of information such as orders, product details, and downloadable content.
List of WooCommerce Tables:
- wp_actionscheduler_actions
- wp_actionscheduler_claims
- wp_actionscheduler_groups
- wp_actionscheduler_logs
- wp_wc_admin_notes
- wp_wc_admin_note_actions
- wp_wc_category_lookup
- wp_wc_customer_lookup
- wp_wc_download_log
- wp_wc_orders
- wp_wc_orders_meta
- wp_wc_order_addresses
- wp_wc_order_coupon_lookup
- wp_wc_order_operational_data
- wp_wc_order_product_lookup
- wp_wc_order_stats
- wp_wc_order_tax_lookup
- wp_wc_product_attributes_lookup
- wp_wc_product_download_directories
- wp_wc_product_meta_lookup
- wp_wc_rate_limits
- wp_wc_reserved_stock
- 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_zones
- wp_woocommerce_shipping_zone_locations
- wp_woocommerce_shipping_zone_methods
- wp_woocommerce_tax_rates
- wp_woocommerce_tax_rate_locations
Here’s a look at each of these tables:
wp_actionscheduler_actions
The wp_actionscheduler_actions table is a key component of the Action Scheduler library used by WooCommerce to handle scheduled or queued tasks in the background. WooCommerce relies on this table to manage automated background actions such as processing refunds, updating stock levels, syncing data with external services, and other time-based tasks.
Here’s a breakdown of the main columns in the wp_actionscheduler_actions table:
action_id: Unique identifier for each scheduled action.hook: The hook or action name that will trigger the task, often referencing a WooCommerce function or operation.status: Current status of the action (e.g.,pending,complete,failed,canceled). This helps track which tasks are still in the queue, which have been completed, and which encountered errors.scheduled_date_gmt: The date and time in GMT when the action is scheduled to run.scheduled_date_local: The date and time in local time when the action is set to execute, useful for local monitoring.args: JSON-encoded arguments passed to the action, storing any relevant data needed when the action runs.schedule: Indicates whether the action is a one-time or recurring task.group_id: An identifier used to group related actions for easier management and tracking.last_attempt_gmt: The last attempt date and time in GMT if the action has been attempted before (especially relevant for retries).last_attempt_local: Last attempt time in local timezone.claim_id: Identifier of the claim assigned to the action when multiple actions are claimed together for processing.extended_args: Additional JSON-encoded data, allowing WooCommerce to store extended information for specific actions.
wp_actionscheduler_claims
The wp_actionscheduler_claims table is part of WooCommerce’s Action Scheduler system and is used to manage groups of scheduled actions that are “claimed” or taken up for processing at the same time. This table helps WooCommerce handle and control the execution of background tasks by grouping them, which allows for more efficient management of tasks and load balancing on the server.
When WooCommerce or another plugin using the Action Scheduler needs to process multiple tasks, it will create a claim. This claim allows the system to “lock” a group of actions, marking them as claimed by a specific process, so no other processes try to execute the same actions concurrently. Once the claim is created, each action associated with the claim will be executed, and the wp_actionscheduler_actions table will update their statuses accordingly.
The wp_actionscheduler_claims table, therefore, plays a crucial role in ensuring reliable and efficient task processing, especially on high-traffic WooCommerce sites, by minimizing the risk of duplicate task execution and optimizing the handling of background tasks.
Table Structure:
claim_id: The unique identifier for each claim. This ID is used to associate the claim with specific actions in thewp_actionscheduler_actionstable.date_created_gmt: The date and time in GMT when the claim was created. This timestamp helps keep track of when a group of tasks was scheduled for processing.
wp_actionscheduler_groups
The wp_actionscheduler_groups table is part of WooCommerce’s Action Scheduler, a system designed to handle background tasks efficiently. This table allows for actions to be grouped by function, enabling WooCommerce to organize, prioritize, and control different types of scheduled tasks. Grouping actions this way is particularly beneficial on busy sites, where multiple background processes run simultaneously, as it helps keep tasks orderly and avoids overloading the server.
Example Use Case: Imagine a WooCommerce store that schedules tasks for different purposes, like sending reminder emails, updating inventory, or processing subscriptions. By grouping these actions, WooCommerce can selectively prioritize or delay certain types of tasks. For instance, high-priority actions like order processing can be grouped separately and processed more quickly, while lower-priority tasks, like updating analytics, can be scheduled to run during off-peak times.
The wp_actionscheduler_groups table thus ensures WooCommerce remains efficient and responsive, even on high-traffic sites with a lot of background activity.
Table Structure:
- group_id: The unique identifier for each action group. This ID links groups to specific actions, stored in the
wp_actionscheduler_actionstable, ensuring that each task can be associated with a particular group. - slug: A descriptive name or “slug” for each group, often indicating the type of actions in that group (e.g.,
woocommerce_scheduled_sales,order_cleanup). This makes it easy to manage and filter actions by type.
wp_actionscheduler_logs
The wp_actionscheduler_logs table is part of WooCommerce’s Action Scheduler and is essential for tracking the history of scheduled actions. This table records each attempt to run a background task, along with its success or failure status. By logging each action’s history, this table makes it easy to monitor, debug, and troubleshoot scheduled tasks on your WooCommerce site.
Table Structure:
- log_id: The unique identifier for each log entry. Each log represents a single event or outcome related to an action, making it easy to look up specific details about past attempts.
- action_id: The ID of the associated action from the
wp_actionscheduler_actionstable. This links each log entry to a specific scheduled action, helping WooCommerce track each action’s execution history. - message: A text message that records the result of the action attempt (e.g.,
Action completed,Action failed). This field can include error messages, completion confirmations, or other status updates, providing detailed feedback on the action’s execution. - log_date_gmt: The date and time in GMT when the log entry was created, helping you pinpoint when each attempt occurred.
- log_date_local: The local date and time of the log entry for easier tracking in your local timezone.
wp_wc_admin_notes
The wp_wc_admin_notes table is used by WooCommerce to manage and display admin notifications within the WordPress dashboard. These notes often contain helpful tips, alerts, reminders, and updates specifically for WooCommerce store administrators.
Table Structure:
- note_id: The unique identifier for each admin note. This ID is used to distinguish individual notes in the database.
- name: The unique name or “slug” of the note, often descriptive of the note’s content (e.g.,
wc-refund-returns-page,your-firts-product). - type: The type of note, which can indicate the purpose or category of the message (e.g.,
update,warning,info). - locale: The language or locale for the note, allowing WooCommerce to display notes in the appropriate language based on the site’s settings.
- title: The title or subject line of the note, giving a concise summary of the note’s content.
- content: The full text of the note, detailing the message, suggestion, or alert intended for the store admin.
- content_data: JSON-encoded data that can dynamically customize the content based on specific conditions, allowing personalized or context-aware notes.
- status: The current status of the note, such as
unactioned,actioned, ordismissed, which shows whether the admin has responded to or acknowledged the note. - source: Source of the note, such as WooCommerce core or an extension, giving admins context on the note’s origin.
- date_created: Date and time when the note was created.
- date_reminder: Optional reminder date for the note to reappear if action is not taken.
- is_snoozable: Boolean value indicating whether the note can be “snoozed” or postponed to appear again later, giving admins flexibility in handling non-urgent messages.
- layout: Defines the layout or appearance of the note, which can vary depending on the importance or type of message.
- image: URL to an image displayed with the note, often used for branding or to make the note more visually distinct.
- is_detected: Boolean indicating if the note was generated automatically based on certain conditions detected in the store (e.g., low stock levels).
- is_read: Boolean indicating whether the note has been read by the admin, helping WooCommerce track which messages have been seen.
- icon: Icon displayed with the note, often used to signify the type or importance of the message visually (e.g., warning, info).
wp_wc_admin_note_actions
The wp_wc_admin_note_actions table complements the wp_wc_admin_notes table by providing actionable options for each admin note in WooCommerce. This table allows WooCommerce to associate specific actions with each notification, such as buttons to “Dismiss,” “Remind me later,” or “View details.” These actions help store administrators manage notes more interactively and respond to reminders and alerts directly from the WordPress dashboard.
Table Structure:
- action_id: Unique identifier for each action, linking it to a specific note.
- note_id: The ID of the note from
wp_wc_admin_notesthat this action is associated with, allowing WooCommerce to connect actions to specific notes. - name: A unique name or identifier for the action (e.g.,
dismiss,view_report,remind_me_later). This serves as a functional reference for each action’s purpose. - label: The text label for the action button that appears in the admin dashboard, providing a user-friendly description of what the action does (e.g., “Dismiss,” “View Details”).
- query: An optional URL or query string that defines the action’s destination or functionality. For instance, this could be a link to a report, a settings page, or a dismissal URL, taking the admin to a relevant page when clicked.
- status: Indicates the current status of the action (e.g.,
available,completed). This helps WooCommerce track which actions are active or completed, providing context for future actions or follow-ups. - actioned_text: Text that may replace the action label after the action is completed. For example, if an action is “Remind Me Later,” the actioned_text could display as “Snoozed” once clicked, indicating the admin has already engaged with it.
- nonce_action: A security field that specifies the nonce action associated with this action, protecting against unauthorized usage. Nonces are a WordPress security feature used to verify user intentions and prevent unauthorized access.
- nonce_name: The name of the nonce field associated with the action, which works with
nonce_actionto add a layer of security by verifying that the action is legitimate and originates from an authenticated source.
wp_wc_category_lookup
The wp_wc_category_lookup table is designed to optimize the way WooCommerce handles product categories. When a site has a large number of products with complex category hierarchies, lookups for category relationships can become slow and resource-intensive. This table improves performance by providing a simplified, pre-built structure for quickly retrieving category information and relationships.
Example Use Case: Consider an online store that sells electronics, where products are organized into multiple levels of categories like “Electronics” > “Laptops” > “Gaming Laptops.” The wp_wc_category_lookup table allows WooCommerce to predefine these relationships. For example, the “Gaming Laptops” category would have the “Laptops” category as its ancestor with a depth of 2, while “Laptops” would have “Electronics” as its ancestor with a depth of 1. This pre-built lookup helps WooCommerce generate category-based product listings and filters more efficiently, improving page load times and enhancing the user experience.
Table Structure:
- category_tree_id: The unique identifier for each category tree entry. This ID represents individual category relationships, simplifying queries related to product categories.
- category_id: The ID of the specific category in question. This links to the
term_idin thewp_termstable, which is used to identify each unique category within WordPress.
wp_wc_customer_lookup
The wp_wc_customer_lookup table centralizes essential customer data in WooCommerce, allowing for quick and efficient access to key customer information. This table is optimized for queries related to customer management, analytics, and reporting, reducing the need to pull data from multiple tables like wp_users and wp_usermeta.
Table Structure:
- customer_id: Unique identifier for each customer, typically linked to their WooCommerce profile.
- user_id: Links to the WordPress user’s ID in
wp_usersfor registered customers. For guest checkouts, this may be null, as guest users don’t have a WordPress user account. - username: The username associated with the customer’s WordPress account, if applicable.
- first_name and last_name: Store the customer’s first and last names, which are helpful for personalization in communications and reports.
- email: The customer’s primary email address, used for order confirmations, notifications, and marketing.
- date_last_active: Tracks the last time the customer interacted with the store, such as logging in or making a purchase. This field helps WooCommerce monitor customer engagement and is valuable for segmentation.
- date_registered: Date when the customer registered with the WooCommerce store. For guest checkouts, this may be null.
- country: The customer’s billing country, useful for location-based analytics and sales trends.
- postcode: The customer’s billing postal code, adding a geographical layer to WooCommerce’s reporting capabilities.
- city: Stores the customer’s billing city, helping with demographic insights.
- state: The billing state associated with the customer, useful for region-specific reporting and analytics.
wp_wc_download_log
The wp_wc_download_log table is necessary in WooCommerce for tracking each instance of product downloads, specifically for stores selling digital products such as eBooks, music, or software. This table helps monitor when downloads occur, who initiates them, and from where.
Table Structure:
- download_id: The unique identifier for each download log entry.
- timestamp: Records the date and time of each download, helping WooCommerce track when customers access their downloadable products.
- permission_id: Links to the specific download permission associated with the product order, connecting back to the
wp_woocommerce_downloadable_product_permissionstable to ensure each download is authorized. - user_id: The WordPress user ID of the customer making the download. For guest users, this may be null, as they do not have a user account.
- user_ip_address: Captures the IP address of the user initiating the download, allowing WooCommerce to track download locations and detect potentially unauthorized access.
wp_wc_orders
The wp_wc_orders table in WooCommerce is the primary table for storing information about each order placed in the store. This table contains essential details about the order’s status, customer, billing, and payment information, supporting the overall order management and tracking process.
Table Structure:
- id: Unique identifier for each order.
- state: Indicates the current status of the order (e.g., pending, completed, refunded), helping WooCommerce and administrators track the order’s lifecycle.
- currency: The currency used for the order, such as USD, EUR, or GBP.
- type: Specifies the type of order, which can help differentiate between regular purchases, subscriptions, and refunds.
- tax_amount: The total tax amount applied to the order, based on the store’s tax settings and customer location.
- total_amount: The overall total of the order, including items, tax, shipping, and discounts.
- customer_id: The ID of the customer placing the order, linked to the customer in the
wp_wc_customer_lookuptable. - billing_email: The email address used for billing, where order confirmations and updates are sent.
- date_created_gmt: The date and time when the order was created, stored in GMT.
- date_updated_gmt: The date and time of the latest update to the order, also in GMT.
- date_updated_gmt: The date and time of the latest update to the order, also in GMT.
- payment_method: The method used for payment (e.g., credit card, PayPal), stored as an identifier.
- payment_method_title: The display title of the payment method, shown to customers at checkout (e.g., “Credit Card” or “PayPal”).
- transaction_id: The transaction ID provided by the payment gateway, used for tracking and verification.
- ip_address: The IP address of the customer when the order was placed, helping identify the customer’s location.
- user_agent: The user agent string from the customer’s browser, which can be useful for detecting device types or resolving issues.
- customer_note: Any note added by the customer during checkout, such as special instructions or delivery requests.
wp_wc_orders_meta
The wp_wc_orders_meta table in WooCommerce serves as a flexible storage area for additional metadata associated with orders. This table is use for storing custom information that doesn’t fit within the standard fields of the wp_wc_orders table.
Table Structure:
- id: Unique identifier for each metadata entry.
- order_id: The ID of the order this metadata is associated with, linking it directly to an entry in the
wp_wc_orderstable. - meta_key: The key for the specific metadata item, serving as a label or identifier for what the metadata represents (e.g.,
_shipping_method,_gift_message). - meta_value: The value associated with the
meta_key, containing the actual data or information relevant to the order (e.g., “Express Shipping,” “Happy Birthday!”).
wp_wc_order_addresses
The wp_wc_order_addresses table in WooCommerce stores address information related to orders, allowing for both billing and shipping details to be saved independently for each order. This structure is essential for WooCommerce to manage different address types and provide flexibility when handling customer information across different regions.
Table Structure:
- id: Unique identifier for each address entry.
- order_id: The ID of the associated order, linking the address details to a specific order in the
wp_wc_orderstable. - address_type: Specifies the type of address (e.g., billing or shipping), allowing WooCommerce to store multiple address types for the same order.
- first_name and last_name: Store the recipient’s first and last names, important for personalizing communications and packages.
- company: The company name associated with the address, useful for B2B orders.
- address_1: Primary address line, typically the street address.
- address_2: Secondary address line, often used for additional information like apartment or suite number.
- city: The city portion of the address, crucial for shipping and localization.
- state: The state or region, important for determining tax rates and shipping costs.
- postcode: Postal code or ZIP code, which aids in accurate delivery and rate calculation.
- country: The country associated with the address, essential for determining shipping availability and rates.
- email: Email address linked to the address, often used for billing or shipping notifications.
- phone: Contact phone number associated with the address.
wp_wc_order_coupon_lookup
The wp_wc_order_coupon_lookup table in WooCommerce tracks the usage of coupons in orders. This table stores records of coupons applied to orders, making it easy to retrieve data on coupon performance, discount amounts, and when each coupon was used. It used for reporting on coupon effectiveness and analyzing customer savings.
Table Structure:
- order_id: Links to the ID of the order where the coupon was applied, connecting it to details stored in the
wp_wc_orderstable. - coupon_id: The ID of the coupon used in the order, associated with the main coupon information found in the
wp_poststable. - date_created: The date when the coupon was applied to the order, useful for tracking coupon usage over time.
- discount_amount: The amount of discount provided by the coupon for the specific order, enabling insight into customer savings and coupon impact.
wp_wc_order_operational_data
The wp_wc_order_operational_data table in WooCommerce stores store operational details for each order. These fields are typically used to handle backend processes, track system actions, and manage specific conditions affecting the order flow. This table provides information on how orders were created, their tax and discount handling, and WooCommerce-specific data for monitoring order operations.
Table Structure:
- id: Unique identifier for each entry.
- order_id: Links to the associated order in the
wp_wc_orderstable. - created_via: Specifies the source of the order creation, indicating if it was placed through the WooCommerce front-end, REST API, or other integrations.
- woocommerce_version: The WooCommerce version in use when the order was created, useful for compatibility tracking.
- prices_include_tax: Indicates whether prices in the order include tax, supporting tax configuration requirements.
- coupon_usages_are_counted: Tracks whether coupon usage was recorded for this order, ensuring coupon limits are respected.
- download_permission_granted: Identifies if download permissions were granted to the customer (important for digital products).
- cart_hash: A unique hash of the cart contents, used to verify cart integrity and changes.
- new_order_email_sent: Tracks whether a new order email notification was sent to the customer, ensuring communication consistency.
- order_key: A unique key generated for each order, used in URLs and order tracking.
- order_stock_reduced: Indicates if stock levels were adjusted based on this order, preventing inventory errors.
- date_paid_gmt: The GMT date and time the order was marked as paid, crucial for financial reporting.
- date_completed_gmt: The GMT date and time the order was marked as completed.
- shipping_tax_amount: Total tax amount on shipping charges, used in calculating the full tax breakdown.
- shipping_total_amount: The total shipping cost for the order.
- discount_tax_amount: Tax amount deducted from the discount, if applicable.
- discount_total_amount: Total discount applied to the order, showing savings.
- recorded_sales: A record of the sales figure attributed to the order, important for revenue and performance analysis.
wp_wc_order_product_lookup
The wp_wc_order_product_lookup table in WooCommerce records product-specific details for each order. This table supports detailed reporting on sales, helping store owners analyze product sales trends and customer purchasing behaviors.
Table Structure:
- order_item_id: Unique identifier for the specific item in the order.
- order_id: Links to the associated order in the
wp_wc_orderstable. - product_id: The ID of the product in the order, used to track product-specific sales data.
- variation_id: ID for product variations, allowing differentiation between different versions of a product (e.g., size or color).
- customer_id: ID of the customer who placed the order, connecting to customer records.
- date_created: The date and time when the product was added to the order, aiding in historical sales tracking.
- product_qty: Quantity of the product ordered, essential for understanding sales volume.
- product_net_revenue: The net revenue from the product, excluding taxes and discounts.
- product_gross_revenue: Gross revenue from the product before deductions, showing overall sales value.
- coupon_amount: The discount amount from any applied coupon specific to this product.
- tax_amount: Total tax amount charged for this product.
- shipping_amount: Shipping costs associated with this product in the order.
- shipping_tax_amount: Tax applied on the shipping amount for this product.
wp_wc_order_stats
The wp_wc_order_stats table in WooCommerce provides a summarized view of order information, storing key metrics that are critical for reporting and analytics. This table simplifies access to overall order performance indicators, supporting WooCommerce’s order management and reporting tools.
Table Structure:
- order_id: Unique identifier for each order, links to the associated order in the
wp_wc_orderstable. - parent_id: The parent order ID, used for handling subscriptions, refunds, or child orders.
- date_created: The date and time the order was created, used in sales reporting.
- date_created_gmt: The GMT version of
date_created, ensuring accurate time zone handling. - date_paid: The date the order was marked as paid, important for financial tracking.
- date_completed: The date when the order was marked as completed, signaling that the order was fully processed and delivered.
- num_items_sold: The number of individual items sold in this order, helpful for inventory tracking and sales volume analysis.
- total_sales: Total sales amount for the order, including all taxes, shipping, and discounts.
- tax_total: Total tax amount charged for this order.
- shipping_total: The shipping cost associated with the order.
- net_total: Net sales amount after deductions, excluding taxes and discounts.
- returning_customer: A boolean or flag indicating if the customer is a returning one, useful for customer retention analysis.
- status: The current status of the order (e.g., pending, completed, refunded).
- customer_id: ID of the customer who placed the order, enabling tracking of customer-specific orders and behavior.
wp_wc_order_tax_lookup
The wp_wc_order_tax_lookup table in WooCommerce captures tax details for each order, breaking down tax amounts by specific rates and types. This table is used for accurately reporting tax obligations and understanding the tax components of order totals.
Table Structure:
- order_id: Unique identifier for each order, links to the associated order in the
wp_wc_orderstable. - tax_rate_id: Identifier for the tax rate applied to the order, linking to specific tax configurations.
- date_created: The date the tax was applied to the order, useful for tax reporting by time period.
- shipping_tax: The tax amount applied specifically to shipping costs.
- order_tax: The tax amount applied to the products and services in the order
- total_tax: The total tax amount for the order, combining
shipping_taxandorder_tax.
wp_wc_product_attributes_lookup
The wp_wc_product_attributes_lookup table in WooCommerce stores information about product attributes, helping to manage product variations, taxonomy classifications, and stock status. This table supports filtering and searching for products by specific attributes or variations.
Example Use Case: To display all available colors for a product and check stock availability, you can query the wp_wc_product_attributes_lookup table for entries with matching product_id and taxonomy set to color. The is_stock field will indicate if the attribute impacts inventory.
Table Structure:
- product_id: The unique identifier for the product to which the attribute is linked.
- product_or_parent_id: The product ID or its parent ID, useful for handling both simple products and variations.
- taxonomy: The taxonomy or attribute type, such as color, size, or any other custom taxonomy created for products.
- term_id: Identifier for the term within the taxonomy, linking the attribute to a specific value (e.g., red for color).
- is_variation_attribute: Indicates if this attribute is used as a variation option (e.g., for different colors or sizes).
- is_stock: Flag indicating whether this attribute affects stock levels, useful in managing stock for variations with distinct inventories.
wp_wc_product_download_directories
The wp_wc_product_download_directories table in WooCommerce manages the download URLs for digital products, allowing control over which download locations are enabled or disabled.
Example Use Case: If a digital product’s download path changes, you can update the url field for the respective url_id and set enabled to false on the old path. WooCommerce then knows to only use the new URL for future downloads.
Table Structure:
- url_id: Unique identifier for each download URL, used to reference specific download paths.
- url: The direct URL for the downloadable product file, specifying the location where the product is hosted.
- enabled: Indicates whether this download URL is enabled, allowing WooCommerce to manage which URLs are accessible for customer downloads.
wp_wc_product_meta_lookup
The wp_wc_product_meta_lookup table in WooCommerce stores metadata about products, including pricing, stock, and rating details. This table enables efficient searching and filtering of products based on attributes like sale status, price range, and stock levels.
The wp_wc_product_meta_lookup table is crucial for WooCommerce’s product filtering, inventory tracking, and sales analysis, providing a quick reference for essential product attributes.
Table Structure:
- product_id: Unique identifier for each product, connecting to the main product data.
- sku: Stock Keeping Unit (SKU) for the product, often used for inventory management.
- global_unique_id: A globally unique identifier for the product, useful for cross-platform or API integrations.
- virtual: Indicates if the product is virtual (e.g., no shipping required).
- downloadable: Specifies if the product is a digital download.
- min_price: The minimum price for the product, aiding in price filtering and sorting.
- max_price: The maximum price for the product, useful for variable products with a price range.
- onsale: Indicates if the product is currently on sale.
- stock_quantity: The available stock quantity for the product.
- stock_status: The current stock status (e.g., in stock, out of stock).
- rating_count: The number of customer ratings received, contributing to product popularity analysis.
- average_rating: The average customer rating, aiding in product ranking and reviews.
- total_sales: The total number of units sold, useful for tracking product performance.
- tax_status: Defines if the product is taxable.
- tax_class: The tax class applied to the product, enabling precise tax calculations.
wp_wc_rate_limits
The wp_wc_rate_limits table in WooCommerce is designed to manage rate limiting, controlling access frequency to certain resources or actions within WooCommerce. This helps prevent excessive usage and potential abuse, ensuring stable performance for customers and administrators.
Example Use Case: If a user is allowed a certain number of API requests per hour, rate_limit_key would identify the API endpoint, rate_limit_expiry would specify when the limit resets, and rate_limit_remaining would decrement with each request.
The wp_wc_rate_limits table plays a key role in managing access control, helping to prevent overuse of resources and maintain WooCommerce’s stability.
Table Structure:
- rate_limit_id: A unique identifier for each rate limit entry.
- rate_limit_key: A key to identify the specific action or resource being rate-limited.
- rate_limit_expiry: The timestamp indicating when the rate limit expires, allowing access to the limited resource again.
- rate_limit_remaining: The number of remaining allowed actions within the current rate limit period.
wp_wc_reserved_stock
The wp_wc_reserved_stock table in WooCommerce temporarily reserves stock for pending orders, preventing over-selling by holding inventory until the customer completes the purchase or the reservation expires.
Example Use Case: When a customer adds a product to their cart and proceeds to checkout, WooCommerce reserves stock in this table. If the customer abandons the checkout process, the reserved stock is released when the expires time is reached, returning inventory back to availability.
Table Structure:
- order_id: Unique identifier for the order associated with the reserved stock.
- product_id: The ID of the product for which stock is being reserved.
- stock_quantity: The amount of stock reserved for the order.
- timestamp: The time when the stock was reserved, used for tracking and auditing.
- expires: The timestamp for when the reservation expires, releasing the stock if the order is not completed.
wp_wc_tax_rate_classes
The wp_wc_tax_rate_classes table in WooCommerce defines different tax classes available in the store, allowing administrators to set varying tax rates for products based on the class applied. This helps customize tax settings for specific product types or regions.
Example Use Case: WooCommerce can assign tax rate classes like “Reduced Rate” or “Zero Rate” to products, each with specific tax rate configurations. By applying different tax classes, WooCommerce can manage tax requirements for varied product types or international sales.
Table Structure:
- tax_rate_class_id: A unique identifier for each tax rate class.
- name: The name of the tax rate class, used for display in the WooCommerce dashboard.
- slug: A URL-friendly version of the tax rate class name, used internally to identify the tax class.
wp_wc_webhooks
The wp_wc_webhooks table in WooCommerce manages webhooks that facilitate automated communication with external services, allowing real-time data updates between WooCommerce and third-party platforms.
Example Use Case: An online store could use webhooks to automatically notify a third-party inventory system when a product is sold. When an order is placed, a webhook triggers, sending order details to the external system.
Table Structure:
- webhook_id: A unique identifier for each webhook.
- status: The current status of the webhook, such as active or disabled.
- name: The name assigned to the webhook, helpful for identifying its purpose.
- user_id: The ID of the user who created or owns the webhook.
- delivery_url: The URL where the webhook will send data upon activation.
- secret: A secure secret key used to verify the integrity of incoming data from the webhook.
- topic: The specific WooCommerce event that triggers the webhook, such as order creation or product updates.
- date_created: The date when the webhook was created.
- date_created_gmt: The creation date in GMT, ensuring consistency across time zones.
- date_modified: The last modification date of the webhook.
- date_modified_gmt: The GMT version of the modification date.
- api_version: Specifies the WooCommerce API version that the webhook supports.
- failure_count: Counts the number of failed delivery attempts, useful for monitoring and troubleshooting.
- pending_delivery: Indicates if there is a pending delivery for the webhook, signaling an upcoming action.
wp_woocommerce_api_keys
The wp_woocommerce_api_keys table in WooCommerce manages API keys that allow secure access to WooCommerce data, enabling third-party applications to interact with the store’s API.
Example Use Case: An API key might be created for a third-party inventory system to synchronize stock levels with WooCommerce. The system can use the consumer_key and consumer_secret to securely pull product data from WooCommerce.
Table Structure:
- key_id: A unique identifier for each API key entry.
- user_id: The ID of the user who owns the API key.
- description: A short description of the API key’s purpose, useful for identification.
- permissions: Specifies the access level of the API key, such as “read” or “write.”
- consumer_key: A unique key associated with the API, used for identification.
- consumer_secret: A secret key paired with the consumer key to authenticate API requests.
- nonces: Nonce values for enhanced security, protecting against unauthorized requests.
- truncated_key: A truncated version of the consumer key, typically used for display purposes.
- last_access: The timestamp of the last time the API key was used, helpful for tracking activity.
wp_woocommerce_attribute_taxonomies
The wp_woocommerce_attribute_taxonomies table in WooCommerce stores custom product attributes, enabling more detailed product descriptions and enhanced sorting and filtering options for customers.
Example Use Case: If a WooCommerce store sells clothing, attributes like “Size” and “Color” can be defined in this table. The attribute_type can determine whether these options are presented as dropdowns or text fields, while attribute_orderby defines the order for each attribute’s values.
Table Structure:
- attribute_id: A unique identifier for each attribute entry.
- attribute_name: The machine-friendly name of the attribute, used internally.
- attribute_label: The human-readable label of the attribute, displayed on the frontend and in the admin interface.
- attribute_type: Defines the type of the attribute, such as “select” or “text,” specifying how customers interact with the attribute.
- attribute_orderby: Specifies how the attribute values are ordered (e.g., by name or custom order).
- attribute_public: Indicates if the attribute is publicly visible on the frontend, allowing or restricting display in product filters.
wp_woocommerce_downloadable_product_permissions
The wp_woocommerce_downloadable_product_permissions table in WooCommerce manages access permissions for downloadable products, ensuring that only eligible customers can download purchased files.
Example Use Case: If a customer purchases an eBook, this table records their download permission details, including the number of downloads they have left and the access expiration date. Each time the customer downloads the file, download_count updates accordingly.
Table Structure:
- permission_id: A unique identifier for each download permission entry.
- download_id: An ID referencing the specific download file associated with a product.
- product_id: The ID of the downloadable product associated with the permission.
- order_id: The ID of the order through which the product was purchased.
- order_key: A unique key associated with the order, used to validate download requests.
- user_email: The email address of the user with download permissions.
- user_id: The user ID associated with the permission (if the customer is a registered user).
- downloads_remaining: The number of remaining downloads allowed for the user.
- access_granted: The date when access to the download was initially granted.
- access_expires: The date when the user’s download access expires, if applicable.
- download_count: Tracks the number of times the file has been downloaded by the user.
wp_woocommerce_log
The wp_woocommerce_log table in WooCommerce records log entries generated by various processes and plugins within WooCommerce, helping to track errors, warnings, and other significant events.
Example Use Case: When a payment gateway encounters an error during a transaction, it may create a log entry with level set to “error,” detailing the issue in message and recording relevant transaction details in context for troubleshooting.
Table Structure:
- log_id: A unique identifier for each log entry.
- timestamp: The date and time the log entry was created, allowing tracking of events in chronological order.
- level: The severity level of the log, such as “info,” “warning,” or “error.”
- source: The origin of the log entry, typically indicating which WooCommerce component or plugin generated the log.
- message: The main content of the log, providing a description of the event or error.
- context: Additional data or details related to the log entry, often used for debugging or providing context for the message.
wp_woocommerce_order_itemmeta
The wp_woocommerce_order_itemmeta table in WooCommerce stores additional metadata for items in orders, offering flexibility for storing custom information linked to each item within an order.
Example Use Case: If a customer orders a product with custom engravings, the engraving details (like “text” or “color”) are stored in this table as metadata for that specific order item. meta_key could be “engraving_text” with meta_value as the custom text provided by the customer.
Table Structure:
- meta_id: A unique identifier for each metadata entry.
- order_item_id: The ID of the associated item within an order, linking this metadata to a specific product or fee in the order.
- meta_key: The name of the metadata field, defining the type of information (e.g., product attributes, custom options).
- meta_value: The actual value associated with the
meta_key, storing the data relevant to the order item.
wp_woocommerce_order_items
The wp_woocommerce_order_items table in WooCommerce records individual items within each order, whether products, shipping fees, or taxes, and links them to their respective orders.
Example Use Case: In an order containing two products and a shipping fee, each item is listed with its type in this table, with order_item_type distinguishing products from shipping costs, and all items linked to the same order_id.
Table Structure:
- order_item_id: A unique identifier for each item within an order.
- order_item_name: The name of the item, such as the product name, shipping method, or tax type.
- order_item_type: Specifies the type of item, such as “line_item” (for products), “shipping” (for shipping costs), or “tax” (for tax entries).
- order_id: The ID of the associated order, linking each item to a specific order in WooCommerce.
wp_woocommerce_payment_tokenmeta
The wp_woocommerce_payment_tokenmeta table in WooCommerce is designed to store additional metadata related to payment tokens, allowing for extended details and custom attributes for each token.
Example Use Case: If a token represents a saved credit card, details like the card type (Visa, MasterCard) and the last four digits can be stored as metadata here, with meta_key as “card_type” and “last_four_digits” and meta_value containing the corresponding data.
Table Structure:
- meta_id: A unique identifier for each metadata entry associated with a payment token.
- payment_token_id: The ID of the associated payment token, linking this metadata to a specific token record.
- meta_key: The name or key of the metadata field, indicating the type of information (e.g., “card_type” or “last_four_digits”).
- meta_value: The value linked to the
meta_key, storing the actual data associated with the payment token.
wp_woocommerce_payment_tokens
The wp_woocommerce_payment_tokens table in WooCommerce stores information on saved payment tokens, which represent secure payment methods saved by users for future transactions.
Example Use Case: When a customer saves their credit card for future use, the token is generated by the payment gateway and saved here, allowing the customer to reuse the token securely without needing to re-enter sensitive payment details.
Table Structure:
- token_id: A unique identifier for each saved payment token.
- gateway_id: The ID of the payment gateway (e.g., Stripe, PayPal) responsible for processing the token.
- token: The actual token string, which securely represents payment details, often provided by the gateway.
- user_id: The ID of the user associated with this payment token.
- type: Indicates the type of payment (e.g., “credit_card” or “bank_account”).
- is_default: A flag (usually 1 or 0) indicating whether this token is the user’s default payment method.
wp_woocommerce_sessions
The wp_woocommerce_sessions table in WooCommerce is used to manage session data for each customer’s shopping experience, storing information related to their ongoing cart and other interactions on the site.
Example Use Case: When a user adds items to their cart but hasn’t completed checkout, the cart data is saved in this table, allowing the customer to return and find their cart unchanged within the session’s valid timeframe.
Table Structure:
- session_id: A unique identifier for each session, typically auto-generated.
- session_key: A unique key assigned to each session, often based on the user’s session cookie or similar identifier.
- session_value: Serialized data representing session-specific information, such as cart contents, selected items, or other session-based states.
- session_expiry: The timestamp indicating when the session is set to expire, helping manage data retention and session validity.
wp_woocommerce_shipping_zones
The wp_woocommerce_shipping_zones table stores data on shipping zones in WooCommerce, which are regions or groups of regions where specific shipping methods and rates are applied.
Example Use Case: Shipping zones allow a WooCommerce store to offer different shipping rates based on the customer’s location. For instance, you might have different zones for domestic and international shipping, each with its own set of rates and methods.
Table Structure:
- zone_id: A unique identifier for each shipping zone.
- zone_name: The name assigned to the shipping zone (e.g., “Domestic” or “Europe”).
- zone_order: The order of the zone in the priority list, helping WooCommerce decide which zone to apply first when multiple zones could apply to a customer’s address.
wp_woocommerce_shipping_zone_locations
The wp_woocommerce_shipping_zone_locations table in WooCommerce is used to define specific locations associated with each shipping zone. This allows a store to assign various regions, countries, or states to shipping zones for targeted shipping rates and methods.
Table Structure:
- location_id: A unique identifier for each location entry within a shipping zone.
- zone_id: The ID of the shipping zone to which this location belongs, linking to the
wp_woocommerce_shipping_zonestable. - location_code: The code representing the location, which may be a country code (e.g., “US” for the United States) or a state code.
- location_type: The type of location defined, such as a country, state, postcode, or continent, allowing for flexible location assignment within zones.
wp_woocommerce_shipping_zone_methods
The wp_woocommerce_shipping_zone_methods table defines specific shipping methods available for each shipping zone in WooCommerce. This table links shipping options—such as flat rates or free shipping—to zones, enabling different shipping methods based on customer location.
Table Structure:
- zone_id: The ID of the shipping zone to which the method applies, linking to the
wp_woocommerce_shipping_zonestable. - instance_id: A unique identifier for each instance of a shipping method within a zone, allowing multiple configurations of the same method in a single zone (e.g., multiple flat rates).
- method_id: The ID of the shipping method (e.g., “flat_rate” or “free_shipping”), representing the type of shipping available in the zone.
- method_order: The order or priority of this method in the zone, which determines which methods are displayed or applied first if multiple options are available.
- is_enabled: A Boolean (1 or 0) indicating whether the shipping method is active (
1) or inactive (0) for the zone.
wp_woocommerce_tax_rates
The wp_woocommerce_tax_rates table stores information about different tax rates applied to WooCommerce orders based on customer location and other parameters. This table helps WooCommerce determine which tax rate to apply depending on the geographical region and priority settings.
Table Structure:
- tax_rate_id: Unique identifier for each tax rate.
- tax_rate_country: The country code where the tax rate applies (e.g., “US” for the United States).
- tax_rate_state: The state or region code where the tax rate applies (e.g., “CA” for California).
- tax_rate: The percentage rate of the tax (e.g.,
7.5for a 7.5% tax). - tax_rate_name: A name or label for the tax rate (e.g., “State Tax”).
- tax_rate_priority: A numerical value indicating the priority of this tax rate when multiple rates are applicable. Lower numbers have higher priority.
- tax_rate_compound: A Boolean (1 or 0) indicating if this tax is a compound tax (
1means compound), meaning it applies on top of other tax rates. - tax_rate_shipping: A Boolean (1 or 0) that specifies if this tax rate should be applied to shipping costs as well.
- tax_rate_order: Specifies the order or position of the tax rate in a list, influencing the display sequence when multiple rates apply.
- tax_rate_class: Defines the tax class (e.g., “reduced-rate” or “standard”), allowing WooCommerce to apply different rates based on product tax classes.
wp_woocommerce_tax_rate_locations
The wp_woocommerce_tax_rate_locations table links specific tax rates to particular geographical locations. This table allows WooCommerce to apply tax rates based on precise locations, such as countries, states, or postal codes, ensuring that tax calculations align with regional requirements.
Example Use Case: A store owner wants to set up a tax rate that only applies to customers in California. In wp_woocommerce_tax_rate_locations, they would create an entry with the location_code “CA,” link it to the relevant tax_rate_id from the wp_woocommerce_tax_rates table, and set location_type to “state.” This configuration ensures that WooCommerce only applies this tax rate to customers in California.
Table Structure:
- location_id: Unique identifier for each location entry.
- location_code: Code representing the location, such as a country code (“US” for the United States) or state code (“CA” for California).
- tax_rate_id: The ID linking this location to a specific tax rate, referencing
tax_rate_idin thewp_woocommerce_tax_ratestable. - location_type: Specifies the type of location for the tax rate, such as “country,” “state,” or “postcode,” which helps WooCommerce determine the applicability of the tax rate based on the customer’s location.
Understanding the structure and purpose of each WooCommerce database table is invaluable for managing a WordPress eCommerce site effectively. WooCommerce expands upon WordPress’s core database with 38 additional tables, each designed to store specific data related to orders, products, customers, and other eCommerce functionalities. These tables work together to support a smooth shopping experience, handle complex tax and shipping configurations, store customer purchase data, manage downloadable products, and even optimize store performance with scheduling and caching.
By familiarizing yourself with these tables, you can more confidently troubleshoot issues, improve store performance, and customize WooCommerce to suit your business needs. Whether you’re a developer creating custom functionality, an administrator managing large volumes of orders, or a store owner seeking to understand how data is stored and processed, having a clear view of WooCommerce’s database structure equips you with the knowledge to make informed decisions for your online store’s success.
Post based on WordPress 6.6.2