I am working on a site and there I am using woocommerce
.
If the user logged in or not, they can add to cart a product, go to cart, go to checkout. But now I want that only logged in users can access these pages.
If the guest user click on the add to cart button the message appear You must be logged in
. If user go to cart page or checkout page they redirect to register page.
Is there any plugin or hook in Woocommerce?
Found here: https://wordpress.stackexchange.com/questions/131562/make-woocommerce-pages-accessible-for-logged-in-users-only
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.
In your case, you can customize the redirect to the You must be logged page.