How to find WooCommerce products in the database

Hey, where in the database (or phpMyAdmin) are my WooCommerce products stored? Sometimes you may have some reason to find directly any product in your database by name, id, custom taxonomy, type, tags, or attributes. Let’s show how to find products that you need and look at the relevant tables which contain your product data.

In newer WooCommerce (since 3.7+) versions are products stored in the following tables (mainly in the first two tables): 

  • wp_posts table with a post_type product or product_variation
  • wp_postmeta table with a post_id as the relational index (the product ID)
  • wp_wc_product_meta_lookup table – product_id as the relational index (the post ID) | Allow fast queries on specific product data
  • wp_wc_order_product_lookuptable – product_id as the relational index (the post ID) | Allow fast queries to retrieve products on orders

SQL query on table wordpress.wp_posts:

SELECT * FROM `wp_posts` WHERE `post_type` LIKE 'product'
phpMyAdmin – search post_type

Product categories, subcategories, tags, attributes, or custom taxonomies are stored in the following tables (some additional plugins got their own tables):

  • wp_terms
  • wp_termmeta
  • wp_term_taxonomy
  • wp_term_relationships – column object_id as the relational index (the product ID)
  • wp_woocommerce_termmeta
  • wp_woocommerce_attribute_taxonomies (for product attributes only)
  • wp_wc_category_lookup (for product categories hierarchy – since WooCommerce 3.7)

In fact, products are stored only as another post type. They can be found in the wp_posts table, under the product post type.

When you find the product that you need, copy its id and easily lookup for the remaining information under other tables.

UNLIMITED DOWNLOADS: 50+ Million Website Templates & Design Assets

All the Website Templates you need and many other design elements, are available for a monthly subscription by subscribing to Envato Elements. The subscription costs $16.50 per month and gives you unlimited access to a massive and growing library of over 50 million items that can be downloaded as often as you need (stock photos too)!

Recent Articles

How to Change WordPress Theme If It Does Not Work (No Access to wp-admin) Through phpMyAdmin

Something is wrong. Your WordPress theme has got a blank screen and you can not log in to your admin through /wp-admin/...

How to Bulk Deactivate WordPress Plugins (No Access to WP-Admin) Through phpMyAdmin

Sometimes happens that you don't have any backups of your WordPress site (ups) and after your plugins update nothing works (ups, twice!),...

Landco – Garden & Landscaping WordPress Theme [Free WordPress theme download]

Demo Download Landco – Garden & Landscaping WordPress Theme Landco – Garden & Landscaping...

Optrica – Optometrist & Eye Care WordPress Theme [Free WordPress theme download]

Demo Download Optrica – A Premium WordPress Theme for all kind of optometrist...

Qwery – Multi-Purpose Business WordPress Theme + RTL [Free WordPress theme download]

Demo Download Giant Multi-Purpose Business Elementor WordPress Theme v1.0.4 Qwery is an innovative responsive...

Get in touch

Be our first-class reader, build a community and follow us on social media!

Leave A Reply

Please enter your comment!
Please enter your name here