PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, June 30, 2022

[FIXED] How to auto login after registration in shopify dawn theme?

 June 30, 2022     liquid, shopify     No comments   

Issue

I have a website on shopify. How to auto login after registration in shopify dawn theme?


Solution

By default, new customers are auto login to the account page after they register a new account. Kindly follow the below steps to auto-login the customer to a specific page when they register a new account. edit your theme layout/theme.liquid file and add this script before the end of the body tag. and change "REDIRECT_PATH".

 <script> 
       (function() { 
 var REDIRECT_PATH = '/account'; // change page url you want redirect after login
       
         var selector = '#create_customer, form[action$="/account"][method="post"]', 
             $form = document.querySelectorAll(selector)[0]; 
       
         if ($form) { 
           $redirect = document.createElement('input'); 
           $redirect.setAttribute('name', 'return_to'); 
           $redirect.setAttribute('type', 'hidden'); 
           $redirect.value = REDIRECT_PATH; 
           $form.appendChild($redirect); 
         } 
       })(); 
          </script>


Answered By - Dotsquares
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing