WooCommerce – Hide price and add to cart button

Use WordPress function is_user_logged_in().

  • Not sure if you are using custom template files or not but you will definitely need to so this custom code will not get overwritten by any theme updates. So in your custom php file, you can wrap price and button in an if statement using that function to check whether a user is logged in then show price and button.
if ( is_user_logged_in() ) {
      echo "Price: " $price;
      echo "<button>Buy</button>