Redirect to Dashboard after login with WooCommerce enabled

Recently, I had to work on a site that had a few things going on:

  1. It had some users with custom roles, and capabilities
  2. Those users had a simplified dashboard
  3. WooCommerce was enabled.

The problem was that when those users logged in, WooCommerce would redirect them to the “My Account” page, instead of their simplified dashboard.

I found a lot of places where they showed how to redirect users after login to “any” page, but it didn’t seem to work when the dashboard was that page.

After some digging around, I discovered that WooCommerce also redirects users that try to access the Dashboard directly to “My Account”.

So, if you are ever in this situation you need to do two things:

  1. Redirect the login (and registration) to the Dashboard
  2. Allow them to access the Dashboard

Here’s the code (change “custom_role” to your users’ role):

Hope this helps someone.

4 Responses to “Redirect to Dashboard after login with WooCommerce enabled”

  1. Babusiaux Guillaume


    i’m trying to make this code work..
    Should i replace mytheme_ by the name of my theme? sorry i’m really noob with coding

    • Alicia Ramirez

      Sorry for the late reply. The code will work whether you change that part or not, but it’s better to change that for the name of your theme.

  2. Tom

    Hello and thank you for your post. I just tried using this code to resolve this same issue at my WordPress site. I could not get it to work. Am I correct in assuming this should go into the functions.php file of my theme?

    • Alicia Ramirez

      Yes, it goes into functions.php. Please try again, I just spotted and fixed a typo on line 3. Also, make sure to change ‘custom_role’ on lines 3 and 17 to the name of the role you want to make the dashboard available to. Hopefully, that will fix it, but keep in mind that I posted this in March, so things may have changed on WooCommerce since then.