Redirect to a specific page after login using the new passwordless login

Topic summary

The discussion addresses how to redirect customers to a specific page after login when using Shopify’s new passwordless login system.

Initial Problem:
PatrickHeck wanted to redirect users to a custom page after passwordless login, similar to using a GET parameter like ?redirect_to=/overview/.

Early Solutions & Limitations:

  • Initial suggestion involved modifying main-login.liquid with a hidden input field, but this only works for classic (password-based) login.
  • Shopify’s new passwordless login initially offered no customization options, forcing some users back to classic accounts.
  • Multiple users expressed frustration that the default behavior redirects to the orders page rather than the previous page or homepage.

Working Solution:
soulchild37 provided a functional approach using the URL format:

/customer_authentication/login?return_to={{ "/" | url_encode }}

This replaces the default /account/login link in theme files.

Implementation Details:

  • For desktop: Modify the login link in header sections
  • For mobile: Also update snippets/header-drawer.liquid
  • Can redirect to specific pages like /account/orders by changing the return_to parameter
  • A detailed tutorial was shared for official Shopify themes

Remaining Issue:
Users report that popup login buttons from third-party apps (like loyalty programs) still redirect to the order page instead of the previous page, with no solution yet provided.

Summarized with AI on October 27. AI used: claude-sonnet-4-5-20250929.

Hi Soulchild37,

I have a loyalty program on my Shopify store that has a popup login button. When users log in through this popup, they are always redirected to the order page instead of returning to the previous page they were on.

Do you know how I could modify the code so that logging in through the popup also redirects users to the previous page they visited?

Thanks in advance for your help!