-
-
Save dturton/7d71edca96b5fb3805eb5af2d8604a32 to your computer and use it in GitHub Desktop.
Shopify Lockdown App: How to remove the "Continue as Guest" button from the login screen.
This file contains 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
<!--In theme.liquid, change:--> | |
<meta content="0; url=/account/login?checkout_url={{ return_url }}" http-equiv="refresh" /> | |
<!--to --> | |
<meta content="0; url=/account/login?return_url={{ return_url }}" http-equiv="refresh" /> | |
<!-- In customers/login.liquid, give the submit button an ID of customerlogin, for example: --> | |
<input class="btn" type="submit" value="Sign In" id="customerlogin" /> | |
<!-- Add this script to the bottom of customers/login.liquid:--> | |
<script type="text/javascript"> | |
$('#customerlogin').click( function(e){ | |
e.preventDefault(); | |
var getUrlVars = function() | |
{ | |
var vars = [], hash; | |
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); | |
for(var i = 0; i < hashes.length; i++) | |
{ | |
hash = hashes[i].split('='); | |
vars.push(hash[0]); | |
vars[hash[0]] = hash[1]; | |
if(hash[0] == "return_url") { | |
var randnum = Math.floor(Math.random()*1001); | |
$.ajax({ | |
type: "POST", | |
url: "/account/login", | |
cache: false, | |
data: $('#customer_login').serialize() + "&random=" + randnum, | |
success: function(html){ | |
window.location.href = vars[hash[0]]; | |
} | |
}); | |
} else { | |
$('#customer_login').submit(); | |
} | |
} | |
return vars; | |
} | |
getUrlVars() | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment