WooCommerce Archives - React to WordPress

WooCommerce Hide Product Price (No Plugin Needed)

Hello, In this simple tutorial I will show you; how to hide your WooCommerce product price even if it’s not set to zero. You will not need to install any plugins or bang your head around on how to implement the code – everything is explained.

Also look WooCommerce Hide Products Without Price (Simple Fix)

How to apply “WooCommerce Hide Product Price” Fix?

This is relatively simple; you have two options, choose one:

  1. Edit your functions.php file with your favorite FTP client add this functions to the end of the file.
  2. Edit through the WordPress theme editor located at Appearance > Editor > functions.php and add this functions to the end of the file.

Read More

WooCommerce Hide Products Without Price (Simple Fix)

Hello and welcome to this simple snippet, Here I will show you on how to hide WooCommerce products which don’t have a price or the price is zero.

Also see WooCommerce Hide Product Price (No Plugin Needed)

How to Apply “WooCommerce Hide Products Without Price”?

This is relatively simple; you have two options, choose one:

  1. Edit your functions.php file with your favorite FTP client add this functions to the end of the file.
  2. Edit through the WordPress theme editor located at Appearance > Editor > functions.php and add this functions to the end of the file.

Hide Products Without Price Hook

1. Hide products with the price set to zero in WooCommerce

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 );
}

If you add this function to your theme `s functions.php it will make the wp_query to show only products which have the price higher than zero.

Read More