Created
January 23, 2024 15:11
-
-
Save TimBHowe/e7d24a41f9650630c1183dfb4a1b2b6d to your computer and use it in GitHub Desktop.
Return all the WooCommerce product and product variation prices set.
This file contains 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 wp_posts.ID, wp_postmeta.meta_value AS sku, wp_posts.post_title AS title, wp_postmeta2.meta_value AS price FROM wp_posts | |
LEFT JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id AND wp_postmeta.meta_key = '_sku' ) | |
LEFT JOIN wp_postmeta AS wp_postmeta2 ON (wp_posts.ID = wp_postmeta2.post_id AND wp_postmeta2.meta_key = '_price' ) | |
WHERE wp_posts.post_type = 'product' | |
OR wp_posts.post_type = 'product_variation' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment