I'm tryng to do a wc_get_products with two meta_query conditions, but it doesn't work. It returns random results and I don't know why (When I refresh the page the products given change)
The code that I'm using is:
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => $itemsperpage,
'paged' => $paged,
'meta_query' => array(
'relation' => 'AND',
array(
'relation' => 'AND',
array(
'key' => '_iop',
'value' => '2',
'compare' => '=',
),
),
array(
'relation' => 'AND',
array(
'key' => '_iop',
'value' => '6',
'compare' => '=',
),
),
),
'orderby' => 'menu_order',
'order' => 'ASC'
);
$products = wc_get_products($args);
I want to show results which meta key _iop is 2 or 6, but doesn't work. ¿Where is the problem?
Thanks!