I have a website using WordPress, and an e-commerce using WooCommerce. I would like my shop (and all its pages) to be seen by logged in users only.
Via the User Access Manager plugin, I have denied access to the shop page, but with a direct link to a product etc. one can access that particular page nonetheless, even if the user is not logged in.
How can I redirect users, who are not logged in, to another page if they try to access a WooCommerce page?
Put this in your
functions.php
file:What does it do?
We check if a not-logged-in user wants to see a WooCommerce page, and redirect him/her to our home page.
I just changed the redirection to
so users are redirected on the “My-Account” page if not logged in or registered.
I would change to this
instead of