Buy All 47 Premium Themes For the Price Of $129.99

How to Redirect WooCommerce Customers After Login Using Hooks

By default, WooCommerce sends users to their account dashboard after login.
However, in many cases you may want to redirect customers to a different page, such as the shop, homepage, or a special offer page.

In this tutorial, you will learn how to customize WooCommerce login redirection using hooks.

Why Custom Login Redirects Are Useful

Redirecting users after login helps improve user experience and can increase sales by guiding customers to the right place immediately.

  • Send users directly to the shop or promotions
  • Improve navigation flow
  • Increase engagement after login
  • Support marketing campaigns

The WooCommerce Filter We Will Use

We will use:

woocommerce_login_redirect

This filter allows us to change the destination URL after a successful login.

Example Code

Add this code to your theme’s functions.php file or a custom plugin:


add_filter('woocommerce_login_redirect', 'custom_login_redirect', 10, 2);

function custom_login_redirect($redirect, $user) {

    if (isset($_GET['redirect_to']) && !empty($_GET['redirect_to'])) {
        return esc_url($_GET['redirect_to']);
    }

    return wc_get_page_permalink('shop');
}

How It Works

This function checks if a custom redirect URL exists and uses it.
Otherwise, it sends the user to the WooCommerce shop page.

  • Checks for custom redirect parameter
  • If found → redirects user there
  • If not → defaults to shop page

Customization Ideas

  • Redirect customers to last visited page
  • Send VIP users to exclusive offers
  • Redirect based on user role
  • Send first-time users to onboarding page