Last active
August 29, 2015 14:26
-
-
Save fuyuko/733d9e78da1bd2b7c684 to your computer and use it in GitHub Desktop.
Query the woocommerce published products (both base products and variations) that have 0 or no weight assigned.
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 weight_info.post_id, weight_info.meta_key, weight_info.meta_value, wp_posts.post_title, quote_info.meta_key, quote_info.meta_value, wp_posts.post_status | |
FROM wordpress_cappels.wp_postmeta as weight_info | |
LEFT JOIN wordpress_cappels.wp_posts ON weight_info.post_id = wp_posts.ID | |
LEFT JOIN wordpress_cappels.wp_postmeta as quote_info ON quote_info.post_id = wp_posts.ID | |
where | |
weight_info.meta_key like '_weight' and | |
quote_info.meta_key like 'quote_product_checkbox' and | |
(weight_info.meta_value like '0' or weight_info.meta_value like '') and | |
(quote_info.meta_value like 'no' or quote_info.meta_value like '') and | |
wp_posts.post_status like 'publish' ; |
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_postmeta.post_id, wp_posts.post_status, wp_postmeta.meta_key, wp_postmeta.meta_value, wp_posts.post_title | |
FROM databasename.wp_postmeta | |
LEFT JOIN databasename.wp_posts ON wp_postmeta.post_id = wp_posts.ID | |
where meta_key like '_weight' and (meta_value like '0' or meta_value like '') and wp_posts.post_status like 'publish'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment