How to Hide Price and add to cart to non-register members in Woocommerce

In this tutorial we’ll learn how to hide the prices and add to cart button to non-registered members. The process is simple enough we can achieve this by using one of woocommerce’s defined filter and by imposing a check to add that filter.

Initially the shop and single product page will look something like this:

Here add to cart button and prices are visible.

Now, if you place the following lines of code at the end of functions.php it will enable the desired functionality.