Skip to content

Instantly share code, notes, and snippets.

@kyleaparker
Last active August 6, 2016 23:33
Show Gist options
  • Save kyleaparker/7812970 to your computer and use it in GitHub Desktop.
Save kyleaparker/7812970 to your computer and use it in GitHub Desktop.
Shopify Lockdown App: How to remove the "Continue as Guest" button from the login screen.
<!--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