Created
March 10, 2019 14:35
-
-
Save fearlex/cd5811687c7ce5ffe46d43d06a738531 to your computer and use it in GitHub Desktop.
Woocommerce Orders queries
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
##-- Show Orders Current Postmeta | |
SELECT DISTINCT pm.meta_key FROM wp_postmeta AS pm LEFT JOIN wp_posts AS p ON p.ID = pm.post_id WHERE p.post_type = 'shop_order'; | |
##-- Show Last 20 Orders | |
SELECT SQL_CALC_FOUND_ROWS hush_posts.ID | |
FROM hush_posts | |
WHERE 1=1 | |
AND hush_posts.post_type = 'shop_order' | |
AND ((hush_posts.post_status = 'wc-pending' | |
OR hush_posts.post_status = 'wc-processing' | |
OR hush_posts.post_status = 'wc-on-hold' | |
OR hush_posts.post_status = 'wc-completed' | |
OR hush_posts.post_status = 'wc-cancelled' | |
OR hush_posts.post_status = 'wc-refunded' | |
OR hush_posts.post_status = 'wc-failed')) | |
ORDER BY hush_posts.menu_order, hush_posts.post_date DESC | |
LIMIT 0, 20 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment