Open functions.php in wordpress theme directory folder inside wp-content->themes->theme name folder then copy and paste the code below inside functions.php
add_action( 'woocommerce_product_query', 'whc_product_hide', 9999, 2 );
function whc_product_hide( $woo, $query ) {
if ( is_admin() ) return;
$meta_query = $woo->get('meta_query');
$meta_query[] = array(
'key' => '_regular_price',
'value' => 0,
'compare' => '>',
);
$woo->set( 'meta_query', $meta_query );
}
Watch the video tutorial in YouTube
Support WeHelpCode by subscribing to our YouTube Channel