I have this query in WP_Query
$products = new WP_Query( array(
'post_type' => 'product',
'starts_with' => $letra,
'posts_per_page' => -1,
'order' => 'DESC',
'meta_query' => array( array(
'key' => '_stock_status',
'value' => 'instock',
'compare' => '=',
),
array(
'key' => 'pre_orders_enabled',
'value' => 'no',
'compare' => '=',
), ),
) );
This shows me products in preorder with the value "no"
The problem is that I also have products that don’t have the "pre_orders_enabled" meta and I need to include them in the WP_Query
In short, I want to display the products that have the value no
in the meta pre_orders_enabled
and the products that do not have the meta pre_orders_enabled
2
Answers