I would like to filter products in WooCommerce by Simple or Variable Product through MySQL; but I could not find as how the WooCommerce stores the data and distinguishes between them in database.
I want an MySQL query to list all the Simple and Variable Product; I don't need any PHP code.
Something like:
SELECT * FROM wp_posts WHERE post_type = 'product' AND product_type = 'simple';
MySQL query to list all Simple Products:
Just replace
simple
fromAND terms.slug = 'simple'
line withvariable
to get all Variable Products;I have tested this SQL query and it is displaying the correct result.
Hope this helps!