a guest Apr 16th, 2018 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- // WORDPRESS 5.0-alpha-42433 + WOOCOMMERCE 3.2.6
- MIN(meta_value) as min_price, MAX(meta_value) as max_price FROM wp_posts p
- JOIN wp_term_relationships tr ON (p.ID = tr.object_id)
- JOIN wp_term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id)
- JOIN wp_terms t ON (tt.term_id = t.term_id)
- JOIN wp_postmeta pm ON (p.ID = pm.post_id)
- WHERE p.post_type='product'
- AND p.post_status = 'publish'
- AND tt.taxonomy = 'product_cat'
- AND t.term_id = <PUT A CAT ID HERE>
- AND pm.meta_key = '_price'
RAW Paste Data