B
B
Boy2017-02-04 05:23:33
WordPress
Boy, 2017-02-04 05:23:33

Woocommerce - after logging in, the user returned to the page from which he came?

Good day!
After logging into Woocommerce, the user gets to "My Account" - how to make it so that after logging into the account, the user returns to the page from which he entered?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WP Panda, 2017-02-04
@demavair

add_filter('woocommerce_login_redirect', 'my_wc_login_redirect', 10, 2);
 
function my_wc_login_redirect(  $redirect, $user  ) {
      return wp_get_referer() ? wp_get_referer() : home_url();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question