Skip to content

Instantly share code, notes, and snippets.

@enamhasan
Created June 24, 2022 13:49
Show Gist options
  • Save enamhasan/e1acfa404396a0f3e69186184a251837 to your computer and use it in GitHub Desktop.
Save enamhasan/e1acfa404396a0f3e69186184a251837 to your computer and use it in GitHub Desktop.
SHOPIFY RESTRICTING ACCESS TO A PAGE / ARTICLE / PRODUCT / COLLECTION WITHOUT LOGIN
<html lang="{{ shop.locale }}">
{% if template contains "wholesale" %}
<!-- wholesale Content -->
{% unless customer %}
{% assign send_to_login = true %}
{% endunless %}
{% endif %}
{% if send_to_login and request.path != "/challenge" %}
<!-- Need to login -->
<meta content="0; url=/account/login?checkout_url={{ request.path }}" http-equiv="refresh" />
{% else %}
<head> </head>
<body> </body>
{% endif %}
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment