
---
title: "How To Redirect Users After Login To WooCommerce"
date: 2018-02-26
author: "Shivanand Sharma"
featured_image: "https://www.converticacommerce.com/wp-content/uploads/2018/02/woocommerce-redirect-after-login.jpg"
categories:
  - name: "UX UI Front-end Development"
    url: "/category/ux-ui-frontend-design.md"
---

# How To Redirect Users After Login To WooCommerce

![](https://www.converticacommerce.com/wp-content/uploads/2018/02/woocommerce-redirect-after-login.jpg)

By default when a user logs into a WooCommerce site, they are redirected to the “My Account” page. Pretty useless IMHO. How about redirecting users to a page of your choice?

The filter `woocommerce_login_redirect` gives you access to two parameters that you can modify to control the login redirect behavior.

1. **The redirect URL:** You can change this to a URL of your choice and the user will be redirected to the same.
2. **User object:** The details of the user who is logging in. From the user object you can pull out all the user details like their ID, role, etc.

```
function my_wc_redirect( $redirect, $user ) {
    // $user_id = $user->ID;
    // if(user_can( $user,  )) { // With the user object you can access their saved carts etc. too.
    // $redirect = get_permalink();
    // }
    // OR without depending on the user
    // $redirect = 'https://www.example.com/checkout';
    return $redirect;
}
add_filter( 'woocommerce_login_redirect', 'my_wc_redirect', 10, 2 );
```