Alicia Ramirez

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.

Exit mobile version