I am currently using woocommerce and would like to redirect none logged in users to the home page, however i am having a little trouble determining where i should implements this
I have done research and determined that using the is_user_logged_in() i can see if the user is logged in.
I tryed implementing in the woocommerce/woocommerce-functions.php
// When default permalinks are enabled, redirect shop page to post type archive url
if (is_user_logged_in() && isset($_GET['page_id']) && $_GET['page_id'] > 0 && get_option( 'permalink_structure' )=="" && $_GET['page_id'] == woocommerce_get_page_id('shop') ) :
wp_safe_redirect( get_post_type_archive_link('product') );
exit;
endif;
but it still allows the page to be visible