Back to Top

Redirect customer on visited page after login in shopify

Updated 16 February 2016

Shopify by default redirect customer on my-account page  after login. But lets say some one searched on your site and find specific product now they want to login on your site . Then after login by-default he move to my-account page but you want move on same product page from where he try to login on your site.

 

Its can possible by following few step.

Step-1

First you need to login on your admin side . Then need to edit some of liquid file. For this click on online store. see image bellow

Start your headless eCommerce
now.
Find out More

image1

 

Step-2

Then click on Themes link. after click on theme link you need to click on three dots . see image bellow

image2

 

Step-3

Then click on Html/css link refer image bellow

image3

Step-4

A luanchpad  has been open  refer image bellow.

iamge4

 

Now you need to find you customer login link liquid in both section asset asn snippets both . liquid file name is depend upon your theme. in my case its available in Snippets. Refer image bellow.

image5

 

Step-5 

Now you need to add some java-script code in this liquid file

<script type="text/javascript">
      var url_array = window.location.href.split('/');
      var length_array = url_array.length;
      if(url_array[length_array-1] !='login')
      {
        var logi_uri = "/account/login?checkout_url="+window.location.href;
        $("#customer_login_link").attr("href",logi_uri)
      }
</script>


Now you ready to redirect user on visited page after login . 🙂

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Back to Top

Message Sent!

If you have more details or questions, you can reply to the received confirmation email.

Back to Home