Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cezarpopa/d9ab16e34339fd955e4b261c8e03d191 to your computer and use it in GitHub Desktop.
Save cezarpopa/d9ab16e34339fd955e4b261c8e03d191 to your computer and use it in GitHub Desktop.
WooCommerce empty sku check
SELECT p.ID,
p.post_title,
p.post_type,
pm.meta_value
FROM wp_posts p
LEFT JOIN wp_postmeta pm
ON pm.post_id = p.ID
AND pm.meta_key = '_sku'
WHERE p.post_type = 'product'
AND (pm.meta_value = ''
OR pm.meta_value IS NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment