Hide WooCommerce for Unregistered Users in WordPress

You can hide the core pages of WooCommerce from unregistered users using a simple WordPress redirect function called template_redirect.

This may come in handy if the woocommerce component is still in development or has a delayed release or is for WordPress registered users only.

Add to your functions.php file

The code will essentially redirect any user that is not logged in to a redirect page – this is declared in the wp_redirect() component which above is set to the home page, to set it to another page just change the value for the site_url()