Home » WooCommerce: Custom Login Redirect @ My Account

WooCommerce: Custom Login Redirect @ My Account

by Tutor Aspire

The WooCommerce My Account login form redirects to… itself once a WordPress user logs in. So, what if you want to redirect logged in users to another page or a different My Account endpoint?

Also, when you have a custom Login page, you may need to redirect users to the… My Account page!

Either way, here’s how to change the default redirect behavior. Enjoy!

Upon “Log in” I’d like users to be redirected to a custom URL. Here’s how you do it.

PHP Snippet: Redirect Logins to Custom URL @ My Account Page

/**
 * @snippet       Custom Redirect for Logins @ WooCommerce My Account
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @compatible    WooCommerce 6
 * @donate $9     https://www.tutoraspire.com
 */

add_filter( 'woocommerce_login_redirect', 'tutoraspire_customer_login_redirect', 9999 );

function tutoraspire_customer_login_redirect( $redirect_url ) {
    $redirect_url = '/shop';
    return $redirect_url;
}

You may also like