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()
7 comments
Michael
Awesome! Works perfect
carlos
It’s work with all the subpages of woocommerce but with the main shop, NOT!!!! why???
Thanks
Dave
Thanks!!!
nic
Please can you explain why it is not working on a child theme? Thanks
Neil Gowran
The code snippet works equally in child themes
Jos
Simple and to the point. Thanks,
simone
Thank you such a help!!!