Redirect Users After WooCommerce Login or Registration

It’s possible to redirect your users to a page other than My Account when they login or register. Try adding the following code using the Code Snippets plugin, or via your preferred method.

Redirect at Login

To redirect at login, you need to use the woocommerce_login_redirect filter.

First of all, we’re checking whether the attempted redirect is for the checkout page; this catches users who are logging in at checkout, as it’s likely they will want to go back there and not some other page on the site. If they’re not at checkout, we redirect them to the WooCommerce shop page. You could even use the $user variable to redirect users based on their capabilities.

Redirect after Registration

To redirect after registration, you need to use the woocommerce_registration_redirect filter.

 

  • Scott

    Hey, the redirect at login is exactly what I was looking for. Unfortunately this code breaks my site, and I cannot see where the problem lies.