Reading list Switch to dark mode

    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.


    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
    Find out More




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




    Then click on Html/css link refer image bellow



    A luanchpad  has been open  refer image bellow.



    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.




    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;

    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