How to Hide WooCommerce Product If Price Is Zero?????

October 24, 2019 0 comments
How to Hide WooCommerce Product If Price Is Zero?????

Wanna to Hide Products, When Price is Zero ?

When you want to give product as freebies for your customers, like on Christmas and you don’t want to spend money for the customer freebies or you might be a developer then this solution is for you???.

If you left the price empty then,Woocommerce will disable the add to cart button.Beside that ,you dont wanna display price product rather you wanna hide the price and replace with message like ”This Product is free”.



  • Go to Dashboard -> Appearance -> Editor
  • Click on functions.php
  • Add the following Code in the end of the functions file
    add_action( 'woocommerce_product_query', 'hide_zero_price_product' );
    function hide_zero_price_product( $q ){
    $meta_query = $q->get( 'meta_query' );
    $meta_query[] = array(
    'key' => '_price',
    'value' => 0,
    'compare' => '>'
    $q->set( 'meta_query', $meta_query );

Ashok kuikel

Ashok Kuikel is DevOps Engineer(Cloud Computing and Cyber Security), Entrepreneur working on Socio-Economic Development via Technology

He has been actively contributing as Joint Secretary of Federation of Computer Association of Nepal Kavre Chapter. Beside that, he is an official Global Peace Ambassador for Global Peace Chain, Nepal Chapter and Member of Internet Society, Nepal Chapter.

Above all, he enjoys learning about new trends and technologies and loves to share innovative ideas to contribute for the growth of the industry.

You can follow me on Social Media, GitHub, and via my Blog Channels.

Leave a Reply

Articles and Tutorials

We love writing about WordPress and latest plugins tutorials, WooCommerce stats, and much more.