How to query product with price range using WP_Query
-
I am trying to query products with price range. My code is leaving variable products as they don’t have the value in the key
_regular_price
.'meta_query' => array( 'relation' => 'OR', array ( 'key' => '_regular_price', 'compare' => 'NOT EXISTS', 'value' => '', ), array( 'key' => '_regular_price', 'value' => array( intval($price_init[0]), intval($price_init[1]) ), 'compare' => 'BETWEEN', 'type' => 'numeric', ), ),
I tried to add NOT EXISTS as well but then also it drops variable product.
How can I query for variable products with the price that appears on the product admin page again the variable product
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to query product with price range using WP_Query’ is closed to new replies.