hello, yes, it totally worked, I just had to add a “)” in the second line of code, it was like this:
function crp_custom_wp_query($query) {
if(is_singular('product') && $query->get( 'crp_query')){
$query->set('post_type', 'product');
$meta_query = [
'relation' => 'AND',
[
'key' => '_stock_status',
'value' => ['instock','onbackorder'],
'compare' => 'IN',
]
];
$query->set('meta_query', $meta_query);
}
return $query;
}
add_filter('pre_get_posts', 'crp_custom_wp_query', 100);
Thank you very much ??