Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can obtain woocommerce products through SQL that are visible to the front-end (not private or password-protected, and can be displayed in the search or catalog) by using the following SQL query:

SELECT * FROM wp_posts

WHERE posttype = 'product' AND poststatus = 'publish'

AND (postpassword = '' OR postpassword IS NULL)

AND (postexcerpt != '' OR postcontent != '');

This query will fetch all the published products that are not password-protected and have either an excerpt or content. You can modify the query as per your requirement.