Redirect user on visited page after login in dawn theme

Topic summary

Goal: After a customer logs in on the Dawn theme, redirect them to the last page they visited rather than a fixed destination.

Proposed approach:

  • Edit Sections > main-login.liquid. Inside the login form, add a field that controls the post-login redirect (replace the default /cart with a dynamic target URL).
  • Use a cookie to store the user’s last visited page. When the customer reaches the login page, use JavaScript to read that cookie and update the form’s redirect input value.

Notes:

  • The referenced code snippet is missing/omitted in the thread; exact implementation details are not provided.
  • The solution hinges on setting a cookie for the last URL and dynamically injecting it into the login form.

Status: No confirmation of a working implementation or final resolution. Action item is to implement the cookie + JS logic and adjust the redirect field in main-login.liquid.

Summarized with AI on January 21. AI used: gpt-5.

Redirect user on visited page after login in dawn theme , i want users to see the last page he visited

Hello @Ak9000 ,

Edit main-login.liquid under Sections
Find the form tag and place this code in it


Note change the /cart with the target URL.
Actually here you have to use cookies to remember the last visited page and when customer reach on the login page replace the input value with JS

Thanks