add_action( ‘woocommerce_product_query’, ‘react2wp_hide_products_higher_than_zero’ );
function react2wp_hide_products_higher_than_zero( $q ){
$meta_query = $q->get( ‘meta_query’ );
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => 0,
‘compare’ => ‘>’
);
$q->set( ‘meta_query’, $meta_query );
}
add_action( ‘woocommerce_product_query’, ‘react2wp_hide_products_without_price’ );
function react2wp_hide_products_without_price( $q ){
$meta_query = $q->get( ‘meta_query’ );
$meta_query[] = array(
‘key’ => ‘_price’,
‘value’ => ”,
‘compare’ => ‘!=’
);
$q->set( ‘meta_query’, $meta_query );
}