Previous i uses legacy account for login , now i switch to the customer account. I added a button to say login, its redirect to the login .after that it is redirect to the orders. I want it to be specific page based on where the user click login button.
Reproduction steps
Just login, after successfully login,it redirect to the orders tabs.
Additional info
So is this a default behavior or we can change it from theme or somewhere else.
I recommend using {{ routes.storefront_login_url }} in your theme.
When you use this URL for your customer account login button, it will send the customer back to where they were when they pressed the login button once logged in
With legacy customer accounts, you can use the return_to form parameter on the login form. There is an example code snippet of how that is handled in our docs:
That won’t work though because we’re already on the login page then. How will we know what page we’ve come from? For example I need to have a login button on a PDP and return to that product specifically after logging in.
Depends on where your customer_login form is located and submitted for legacy customer accounts.
If we take a leaf from the Horizon theme’s book and add a dropdown for customer login so customers can login from any page, then the return_to parameter can still be used with it set to request.path.
Just tested it out to see if any captcha issues get in the way, but seems to work well: