Created
November 12, 2025 07:48
-
-
Save kallookoo/07c482f76af955443d9b9b2e6700d90c to your computer and use it in GitHub Desktop.
Retrieve WooCommerce products without images using SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT | |
| p.ID AS product_id, | |
| sku.meta_value AS sku | |
| FROM wp_posts AS p | |
| LEFT JOIN wp_postmeta AS sku | |
| ON sku.post_id = p.ID | |
| AND sku.meta_key = '_sku' | |
| LEFT JOIN wp_postmeta AS thumb | |
| ON thumb.post_id = p.ID | |
| AND thumb.meta_key = '_thumbnail_id' | |
| WHERE | |
| p.post_type = 'product' | |
| AND thumb.meta_value IS NULL | |
| ORDER BY p.ID; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment