By default, when a user logs into their account on your WooCommerce website, they are redirected to their dashboard on the My Account page. This guide shows you how to change this and redirect the user to any page you like. We’ve also included a handful of most popular pages including how to redirect the user to: Home Page, Shop Page, Cart Page, Checkout Page, and any custom post or page, upon login. Simply comment-out/un-comment the appropriate redirect you would like in place. For the custom page redirect, you will need the post ID of said page. To get the post ID, simply edit that page and the URL will show you the integer ID. Alternatively, you can hover over the post in the back-end editor where you “Quick Edit” posts and you’ll see the ID there too. This particular example redirects the user to a custom page upon WooCommerce account login.
/**
* Snippet Name: WooCommerce Login Redirect
* Snippet Author: ecommercehints.com
*/
add_filter( 'woocommerce_login_redirect', 'ecommercehints_login_redirect', 10, 1 );
function ecommercehints_login_redirect( $redirection_url ){
// $redirection_url = get_home_url(); // Home page
// $redirection_url = get_permalink( wc_get_page_id( 'shop' ) ); // Shop Page
// $redirection_url = wc_get_cart_url(); // Cart Page
// $redirection_url = wc_get_checkout_url(); // Checkout Page
$redirection_url = get_permalink( 121 ); // Custom Page (The ID of the post/page you would like to redirect to - replace '121')
return $redirection_url;
}