Where Are WooCommerce Products Stored In The WordPress Database?

Where is woocommerce storing product data in the database

Sometimes you add new WooCommerce products on your staging site and just want to add those new products to the live site without affecting other data like orders and transactions. Therefore you need to make sure to copy only the relevant tables that contain the WooCommerce product data.

Why Knowing Product Storage Locations Matters

Understanding where WooCommerce products are stored can be useful for:

  • Custom Queries: Retrieving product data using SQL queries for reporting or custom functionality.
  • Database Optimization: Cleaning up unnecessary data to improve performance.
  • Troubleshooting Issues: Resolving problems with missing or incorrect product details.
  • Data Migration: Moving products between different WordPress installations.

Key Tables Storing WooCommerce Product Data

WooCommerce primarily stores product data in two tables:

  • wp_posts – Contains product entries with a post type of product or product_variation.
Find WooCommerce Product Details using wp_posts Table
  • wp_postmeta – Stores additional metadata for each product, linked via post_id (product ID).
Find Product detail using wp_postmeta Table

Tables Storing Product Categories, Tags, and Attributes

In addition to the core product tables, WooCommerce uses several taxonomy-related tables to manage product types, categories, subcategories, tags, and attributes:

  • wp_terms – Stores product categories and tags.
  • wp_termmeta – Stores metadata for product terms.
  • wp_term_taxonomy – Defines the taxonomy type (e.g., category, tag, attribute).
  • wp_term_relationships – Links products to their categories and attributes.
  • wp_woocommerce_termmeta – Stores additional WooCommerce-specific term data.
  • wp_woocommerce_attribute_taxonomies – Manages product attributes specifically.

WooCommerce Product Types and Visibility

WooCommerce handles different product types using the product_type taxonomy, which includes the following default options:

  • simple – A standard product with no variations.
  • grouped – A collection of related products.
  • variable – A product with multiple variations.
  • external – A product sold on an external website.

Since WooCommerce 3+, a new taxonomy called product_visibility manages:

  • Search and catalog visibility – Uses terms like exclude-from-search and exclude-from-catalog.
  • Featured products – Identified using the term featured.
  • Stock status – Uses outofstock to indicate unavailable products.
  • Ratings – Terms like rated-1 to rated-5 categorize product reviews.

Each product attribute is stored as a custom taxonomy, making it easy to categorize and filter products dynamically.

Best Practices for Copying Product Data to a Live Site

When moving new products from a staging site to a live site, avoid overwriting critical data like orders and customer transactions. To achieve this:

  • Copy only relevant tables – Focus on wp_posts, wp_postmeta, and taxonomy-related tables.
  • Exclude order-related tables – Avoid tables prefixed with wp_woocommerce_ unless necessary.
  • Use database migration tools – Plugins like WP Migrate DB Pro or WP All Export can help streamline the process.

Conclusion

WooCommerce products are stored mainly in wp_posts and wp_postmeta, while categories, attributes, and visibility settings are managed in related taxonomy tables. Understanding this structure helps in safely migrating product data without affecting live store operations.

References: