By default WooCommerce redirects the user to the My Account page after a successful login.
You may change this and use a custom URL based on the user role, like the Dashboard for admins and My Account page for customers.
To do this, add this code at the end of the file functions.php located in wp-content/themes/your-theme-name/
/** * Redirect users to custom URL based on their role after login * * @param string $redirect * @param object $user * @return string */ function wc_custom_user_redirect( $redirect, $user ) { // Get the first of all the roles assigned to the user $role = $user->roles[0]; $dashboard = admin_url(); $myaccount = get_permalink( wc_get_page_id( 'myaccount' ) ); if( $role == 'administrator' ) { //Redirect administrators to the dashboard $redirect = $dashboard; } elseif ( $role == 'shop-manager' ) { //Redirect shop managers to the dashboard $redirect = $dashboard; } elseif ( $role == 'editor' ) { //Redirect editors to the dashboard $redirect = $dashboard; } elseif ( $role == 'author' ) { //Redirect authors to the dashboard $redirect = $dashboard; } elseif ( $role == 'customer' || $role == 'subscriber' ) { //Redirect customers and subscribers to the "My Account" page $redirect = $myaccount; } else { //Redirect any other role to the previous visited page or, if not available, to the home $redirect = wp_get_referer() ? wp_get_referer() : home_url(); } return $redirect; } add_filter( 'woocommerce_login_redirect', 'wc_custom_user_redirect', 10, 2 );
If you simply need a redirect for all users, please see this article.
Views (206)
The following two tabs change content below.

Chris Mok
Senior Developer at GNA eMarketing
Core Contributor on the WordPress.org

Latest posts by Chris Mok (see all)
- WHM – Change account setup date manually - August 25, 2016
- Manually generate the notifications to who over disk quota - August 23, 2016
- Help Desk Management: What is Level 1, Level 2, and Level 3 Help Desk support? - July 27, 2016
- Find and delete files greater than a given size from the Linux command line - April 18, 2016
- How to change WordPress default email’s From name and address - April 15, 2016