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

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

PatrickHeck
Tourist
3 0 1

Hi everyone!


I'd like to use the new passwordless login experience, described here: https://help.shopify.com/de/manual/customers/customer-accounts/new-customer-accounts

After login in, though, I'd like to redirect customers to a page I specify. Does anyone know, it that's possible?

 

I'm thinking of something like a GET parameter, that can be appended to the login URL.

e.g. https://shopify.com/XXXXXXXXXX/account ?redirect_to=/overview/

In this example, the "?redirect_to=/overview/" part would specify the target after login.

 

Any hints?

Best
Patrick

Replies 25 (25)

gr_trading
Shopify Partner
2034 149 206

Hi @PatrickHeck 

 

To change the landing url after login please follow the below steps.

 

Go to online-store - > edit theme search for main-login.liquid and find code

 

{%- form 'customer_login', novalidate: 'novalidate' -%}

 

now put the below line just after the above code

 

<input type="hidden" id="checkout_url" name="checkout_url" value="/">

 

value="/" refer to homepage here you can provide any URL.

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
PatrickHeck
Tourist
3 0 1

Thanks @gr_trading ! But isn't main-login.liquid meant to control the classical login? (The login that needs a password)

gr_trading
Shopify Partner
2034 149 206

Hi @PatrickHeck 

 

Yes, you are right because shopify don't allow any kind of editing to login, and account flow.

 

Therefore if you need any design or flow change you have to switch to classic login.

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
edzioDevs
Shopify Partner
1 0 0

Here's the most concise approach to do this: 
just below this line "{%- form 'customer_login', novalidate: 'novalidate' -%}" in the login section , paste this line: "<input type="hidden" name="return_to" value="/collections">". You can replace "/collections" with the page you wanna redirect your user to after a successful login.

linia
Excursionist
31 2 38

Will the new login experience never have abilities for customization?  

Meaning... if there is anything in it that's not working for a certain store solution, is the only option to go back to classic?

I've just made the switch myself and am not fully understanding if there are *any* customization options at all.

Since you started this a few month ago, Patrick, I wonder if you can help me understand this.

PatrickHeck
Tourist
3 0 1

Hi Linia,

thanks for contributing to this thread. However, I don't have any further information than the accepted solution contains. For general customization options, apart from the one discussed here, take a look at the manual: https://help.shopify.com/de/manual/customers/customer-accounts/new-customer-accounts.

linia
Excursionist
31 2 38

Thanks so much for the response.  Yes - I had run into that documentation while switching myself. 

The documentation is helpful. I just didn't realize that the flow would be and going to the 'orders' page after login, which is quite unintuitive/problematic for my business, given the experience we need to provide clients.

The fact that there can be no customization is a bit surprising.

In any case - may end up going back to classic accounts.  Thanks again for your response!

Vonda_Youngkin
Pathfinder
93 0 62

This is one of the dumbest things I've ever seen.  I finally made the switch last night to the New Customer accounts.  Just tested this morning, and it's taking me to an account page?  No other website I've ever used does that.  It takes you right back to the page you were on when you logged in.  So. Dumb.

prateeksha
Shopify Partner
12 2 3

Agree. I had to switch to classic account for this functionality earlier in the year. Am revisiting this now as I really would like the frictionless login experience of 'new accounts', but also need the frictionless redirecting ability of classic accounts. Assuming from this comment in Sep that the situation still hasn't changed.

gr_trading
Shopify Partner
2034 149 206

Hi @linia,

 

To customise the order section Shopify is working for order checkout extension permissions.

 

its in developer mode and allowed to build and test the apps.

 

Shopify is trying to stop users to polluting its theme structure by stoping the access to their key resources and making more scoping to do things using APPs only.

 

 

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
linia
Excursionist
31 2 38
That’s sad that this will only be through apps 😕

I can see their perspective, but if you’re not a developer and don’t want to spend money on apps for every tiny thing you want to do, this makes the new experience quite unusable.

But thank you for the information - at least now I know this means I have to go back to the old version. The default behavior doesn’t work for my business.

Thanks for taking the time to share the overall direction they’re going in!

soulchild37
Shopify Partner
224 9 64

It is now possible to redirect to specific page after login on the new passswordless login, it is similar to the login URL you first mentioned.

You can use this link format (replace the default "/account/login" in your theme ) :

<a href="/customer_authentication/login?return_to={{ "/" | url_encode }}">Login</a>

 


https://shopify.dev/docs/storefronts/themes/login#direct-customers-back-to-another-page-on-the-onlin...

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog
sebastian_pr
Shopify Partner
1 0 0

This is working properly. thank you very much.

kgoslat
Visitor
2 0 0

Will this work if I want to redirect from the profile page to the order page, all within the new customer accounts feature? 

gr_trading
Shopify Partner
2034 149 206

Hi @kgoslat ,

Yes, its working. We implement this to our store to enable force login to see the code and once they are logged in. It's redirecting user to its blog post.

 

See it in action here
https://letsdebugcode.grtrading.in/blogs/news/how-to-add-a-custom-donation-product-in-shopify

For any custom development WhatsApp or connect at Email ID: support@grtrading.in for quick consultation. | Shopify Free codes
To support Buy Me a Coffee
Armin22
New Member
12 0 2

Hi, I followed your suggestion to replace /account/login with /customer_authentication/login?return_to={{ "/" | url_encode }}, but it's not redirecting to the homepage after login.

Could you please provide a step-by-step guide on exactly where to place this link in my Shopify theme?

  • Which file(s) should I modify?
  • Where exactly in the code should I replace the login link?
  • Do I need to change any Shopify settings for this to work?

I appreciate your help!

soulchild37
Shopify Partner
224 9 64

Hi Armin,

Which file did you modify to change the " /account/login" with "/customer_authentication/login?return_to={{ "/" | url_encode }}"  ?

This is specific to the new customer accounts (Shopify Settings > Customer accounts > Customer accounts).

I have written a step by step tutorial here :  https://yagisoftware.com/articles/how-to-redirect-new-customer-account-login-to-different-page

The tutorial covers official Shopify themes.

Hope this can help.

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog
Armin22
New Member
12 0 2

Thank you so much!  Your tutorial was an absolute lifesaver, and it worked perfectly!  I was able to set up the redirect successfully. I really appreciate your help—you're a legend! 

Armin22
New Member
12 0 2

It works on the desktop version. Do I need to set it up differently on mobile?

 
soulchild37
Shopify Partner
224 9 64
You do not need to set it up differently for mobile, the code should work
for both desktop and mobile.
Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog
Armin22
New Member
12 0 2

On desktop its working perfectly fine but on mobile still redirect me to account page

soulchild37
Shopify Partner
224 9 64

Hi Armin, sorry I just checked, for mobile, the drawer menu will be used, you will need to edit the "snippets/header-drawer.liquid" file, with the same step. (change routes.account_url ), hope this helps! I also updated my blog post to include this step.

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog
Armin22
New Member
12 0 2

Thank you thats work.

kgoslat
Visitor
2 0 0

Will this method successfully redirect customers to their order page instead of the profile page when using passwordless login? I want to make sure they don’t land on the profile page. I'm not a developer, so I appreciate your explanation—it'll help me pass this along to someone who can implement it. Thanks so much for your help!

soulchild37
Shopify Partner
224 9 64

Yes, to redirect to order page (instead of homepage from my original solution),  you can replace the following code :

<a href="/customer_authentication/login?return_to={{ "/" | url_encode }}">Login</a>

 

with this code

<a href="/customer_authentication/login?return_to={{ "/account/orders" | url_encode }}">Login</a>

 

(notice the "/account/orders").

Hope this helps.

Spent too much support time dealing with order cancellation request from customer? Wouldn't it be good if customer can cancel order on their own without bugging your support? Try out Cancellable app! https://apps.shopify.com/cancellable . I also write articles about store customization that can improve your customer shopping experience here : Yagi Software Blog