-
-
Save loktah/a3a2b0b2daa74f3c55b9a3a3e593841a to your computer and use it in GitHub Desktop.
Redirect user to previous page after login shopify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add this hidden field inside customer login form | |
<input class="devRedirect" type="hidden" name="checkout_url" value="/collections/all" /> | |
//then add the following script at the end of customers/login.liquid file | |
<script> | |
$(document).ready(function(){ | |
var devRef = document.referrer; | |
$('.devRedirect').val(devRef); | |
}); | |
</script> |
i don't know why the script is not showing in my code but i placed it at the end
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi i've tried your code and it keep sending me to the collections/all and not to the previous url , what i'm doing wrong ?
`
`