April 27, 2015 at 4:34 am
Hi guys.
I would like to redirect my customers to the page they were viewing after they login instead of my account. I have managed to redirect them to go to a certain page after they login using a snippet of code and putting it in functions php, but I really need them to be returned to the page they were viewing. This is the code I have inserted to return them to a certain page. How can I modify this so they will be redirected to the the page they were viewing.
<?php
// Custom redirect for users after logging in
add_filter(‘woocommerce_login_redirect’, ‘bryce_wc_login_redirect’);
function bryce_wc_login_redirect( $redirect ) {
$redirect = ‘*Login to see link
return $redirect;
}
// Custom redirect for users after logging in
add_filter(‘woocommerce_registration_redirect’, ‘bryce_wc_register_redirect’);
function bryce_wc_register_redirect( $redirect ) {
$redirect = ‘*Login to see link
return $redirect;
}
Any thoughts would be greatly appreciated.
Kind regards, Paul