You need to put below code in your functions.php file:
function wpse_131562_redirect() {
if (
! is_user_logged_in()
&& (is_woocommerce() || is_cart() || is_checkout())
) {
// feel free to customize the following line to suit your needs
wp_redirect(home_url());
exit;
}
}
add_action('template_redirect', 'wpse_131562_redirect');
It will if a not-logged-in user wants to see a WooCommerce page, then redirect him/her to our home page.