How to redirect affiliates to their dashboard after login
WooCommerce normally sends logged-in users to My Account. To send approved AffiliateWP affiliates to their dashboard instead, use WooCommerce’s login redirect filter or install an add-on that handles the redirect for you.
- 01Check the Affiliate Area first
- 02Choose the manual route
- 03Add the redirect snippet
- 04Test every login path
- 05Check conflicts before going live
- 06Use the fast add-on route
What you need
- A WooCommerce store with AffiliateWP installed and configured
- An Affiliate Area page created by AffiliateWP
- Administrator or code-snippet access
- A staging site or recent backup
Check the Affiliate Area first
In WordPress, go to AffiliateWP and confirm that the Affiliate Area page exists and contains the Affiliate Area block or the [affiliate_area] shortcode. AffiliateWP normally creates this page during setup, and you can change the selected page in AffiliateWP’s affiliate settings.
Copy the full URL of that page. The redirect code needs the real dashboard URL, not the WooCommerce My Account URL.
Choose the manual route
The manual route is suitable if you are comfortable adding a small PHP snippet and all affiliates should use the same dashboard. Use a code-snippet plugin or a child theme rather than editing the parent theme, because a theme update can remove changes made to its files.
WooCommerce applies the woocommerce_login_redirect filter when processing its standard login form, including the My Account login.
Add the redirect snippet
Add this code with your code-snippet tool. Replace /affiliate-area/ with the path to your Affiliate Area page.
add_filter( 'woocommerce_login_redirect', function( $redirect, $user ) {ntif ( ! $user instanceof WP_User ) {nttreturn $redirect;nt}nntif ( function_exists( 'affwp_get_affiliate_id' ) && function_exists( 'affwp_get_affiliate_status' ) ) {ntt$affiliate_id = affwp_get_affiliate_id( $user->ID );nnttif ( $affiliate_id && 'active' === affwp_get_affiliate_status( $affiliate_id ) ) {ntttreturn home_url( '/affiliate-area/' );ntt}nt}nntreturn $redirect;n}, 10, 2 );
This checks the logged-in user’s AffiliateWP account and redirects active affiliates only. Customers, administrators and pending or rejected affiliate accounts keep WooCommerce’s normal destination.
Test every login path
Open a private browser window and log in through My Account as an active affiliate. Confirm that the user lands on the Affiliate Area and can see their links, statistics and account sections. Then repeat the test with a normal customer and an administrator.
The common Friday problem is an incorrect page path: the redirect works, but the affiliate dashboard returns a 404 or sends the user back to login. Also test checkout login if your affiliates use it, because custom login forms or social-login tools may use their own redirect process.
Check conflicts before going live
Disable any other login-redirect rules temporarily, including role-based redirect plugins and snippets using login_redirect. A later redirect rule can override this one, while a redirect loop can occur if the Affiliate Area itself requires a different login page.
Exclude the Affiliate Area and affiliate login pages from full-page caching where necessary. AffiliateWP recommends excluding its account, registration and login pages from caching so logged-in and logged-out content is not mixed.
Use the fast add-on route
If you do not want to maintain PHP code, install and activate AffiliateWP WooCommerce Redirect Affiliates. It is designed for this exact case: affiliates who log in through WooCommerce’s /my-account page are sent to the AffiliateWP affiliate area instead.
After activation, confirm the Affiliate Area URL and test an active affiliate account. Use the add-on when you want a narrower, easier-to-maintain solution; the code route is fine when you already manage site snippets and need custom conditions.
Let AffiliateWP WooCommerce Redirect Affiliates do it
Sends AffiliateWP users straight to their affiliate area instead of WooCommerce My Account after login.
Sources
- affiliatewp.com /docs/creating-the-affiliate-area/?utm_source=openai
- woocommerce.github.io /code-reference/files/woocommerce-includes-class-wc-form-han…
- affiliatewp.com /docs/does-affiliatewp-work-with-caching/?utm_source=openai
- affiliatewp.com /addons/woocommerce-redirect-affiliates/?utm_source=openai
- woocommerce.com /products/redirect-after-login-registration-and-logout/?utm_…
- affiliatewp.com /docs/affiliate_login/?utm_source=openai
Questions
- Does WooCommerce redirect affiliates to their dashboard by default?
- No, WooCommerce normally sends a user who logs in through My Account to the My Account page or the requested destination. AffiliateWP creates the Affiliate Area, but the WooCommerce login form does not automatically send every active affiliate there. You must add a redirect rule or use an integration add-on.
- Can I redirect only active AffiliateWP affiliates?
- Yes, the manual snippet can check both the user’s AffiliateWP affiliate ID and affiliate status before changing the destination. That prevents ordinary customers and unapproved affiliates from being sent to the dashboard. Keep the status check if applications require approval, because pending and rejected accounts should not be treated as active affiliates.
- Why does the redirect work on My Account but not on checkout?
- The WooCommerce filter covers the standard WooCommerce login handler, but a custom checkout, membership system or social-login tool may process authentication separately. Check whether the failing form uses WooCommerce’s normal login process, then look for that tool’s own redirect setting or hook.
- Can affiliates use a custom dashboard page instead of Affiliate Area?
- Yes, set the redirect URL in the snippet to any page that contains AffiliateWP’s Affiliate Area block or shortcode. If affiliates log in through AffiliateWP’s own login form, you can also set a custom redirect in the block settings or pass a destination through the login shortcode.