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)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.