WooCommerce – Redirect to a custom page after logging in for All Users

Sometimes you may want to send users to a unique or custom URL after logging in through WooCommerce.

No need for additional plugins or complicated code.

Just add the following code to the custom functions area of your functions.php file.

// Custom redirect for users after logging in
add_filter('woocommerce_login_redirect', 'wcs_login_redirect');
function wcs_login_redirect( $redirect ) {
     $redirect = 'http://google.com/';
     return $redirect;

It’s very easy to customise the above URL, either by entering a plain URL or using a WordPress function, like:


Or you could swap out the following number for the page ID you want to link to:

get_permalink( 25 );

How about after they log out? I’ve written about that too in this tutorial.

In addition, if you’d like to do the same but after a user registers, try the following:

// Custom redirect for users after logging in
add_filter('woocommerce_registration_redirect', 'wcs_register_redirect');
function wcs_register_redirect( $redirect ) {
     $redirect = 'http://google.com/';
     return $redirect;

Views (102)

Share on Facebook0Share on Google+0Share on LinkedIn0Tweet about this on TwitterEmail this to someonePrint this page
[Total: 1    Average: 5/5]

Leave a Reply

Your email address will not be published. Required fields are marked *

twenty + fourteen =