Not capable of fetch variation gross sales product in response to specific product class . My code fetch solely easy merchandise not variable merchandise.
$cat_id = $_GET['catid'];
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' =>-1,
'meta_query' => array(
'relation' => 'OR',
array( // Variable merchandise sort
'key' => '_min_variation_sale_price',
'worth' => 0,
'examine' => '>',
'sort' => 'numeric'
),
array( // Easy merchandise sort
'key' => '_sale_price',
'worth' => 0,
'examine' => '>',
'sort' => 'numeric'
)
),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'discipline' => 'term_id', //That is elective, because it defaults to 'term_id'
'phrases' => $cat_id,
'include_children' => true,
'operator' => 'IN' // Doable values are 'IN', 'NOT IN', 'AND'.
)
)
);
$merchandise = new WP_Query($args);