Thread Starter
Zee
(@gphx)
The solution I am using: hide the actual wishlist page for logged-out users. When they click the ‘Wishlist’ page, it will re-direct them to the Register page. If they’re logged in, it will take them to the Wishlist page.
Add this code to your functions.php file – hope this helps!
add_action( 'template_redirect', 'redirect_to_specific_page' );
function redirect_to_specific_page() {
if ( is_page('slug') && ! is_user_logged_in() ) {
wp_redirect( 'http://www.example.dev/your-page/', 301 );
exit;
}
}
Its not working for me any other solutions, i want without login try to add wishlist it will redirect to my account page, any solutions? thanks for reply
Hi Rajasuresh,
“Add to wishlist” button makes an ajax call, to add product in the wishlist; if user is not logged in, a cookie with wishlist contents will be set in user browser.
Change this behavior is quite hard, and we can’t send you a chunk of code that do this for you.
Maybe, we will add this to a future release.
Stay tuned, and have a nice day 🙂