script to hide zero price products not working with cache
-
Hello, I’m using this scipt to hide zero price products in search and archive woocommerce pages, sript is not working with cache:
add_filter( ‘woocommerce_product_query_meta_query’, ‘shop_only_instock_products’, 10, 2 );
function shop_only_instock_products( $meta_query, $query ) {
// In frontend only
if( is_admin() ) return $meta_query;$meta_query[‘relation’] = ‘OR’;
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => ”,
‘type’ => ‘numeric’,
‘compare’ => ‘!=’
);
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => 0,
‘type’ => ‘numeric’,
‘compare’ => ‘!=’
);
return $meta_query;
}
Thanks a lot for any kind of help
Olaf
- The topic ‘script to hide zero price products not working with cache’ is closed to new replies.