Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions layout/theme.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,12 @@
- The template is defined (will be undefined for app proxies like /apps|a|community|tools/*)
- The current template is not the login page, unless multipass login is enabled
{% endcomment %}
{%- assign should_redirect = template != blank and template.name != 'login' or settings.multipass_login -%}
{%- liquid
assign should_redirect = false
if settings.multipass_login or template != blank and template.name != 'login'
assign should_redirect = true
endif
-%}

{%- if settings.storefront_hostname != blank and should_redirect -%}
<script>
Expand Down Expand Up @@ -181,12 +186,12 @@
var customRedirectsStr = "{{ settings.custom_redirects | newline_to_br | strip_newlines | replace: ' ', '' }}";
if (customRedirectsStr) {
var customRedirects = customRedirectsStr.split('<br/>');

for (var cri = 0; cri < customRedirects.length; cri += 1) {
var redirect = customRedirects[cri].split('>');
var fromPath = redirect[0];
var toPath = redirect[1];

if (fromPath && toPath && redirectUrl.startsWith('https://' + storefrontHostname + fromPath)) {
redirectUrl = redirectUrl.replace(storefrontHostname + fromPath, storefrontHostname + toPath);
break;
Expand All @@ -196,7 +201,7 @@

redirectUrl = new URL(redirectUrl);

{% comment %}
{% comment %}
Handle discount code logic (e.g. xxx.myshopify.com/discount/freeshipping?redirect=/products)
- Add discount code to as param to the edirect URL if the `discount_code` cookie exists
- Cookie is deleted after to prevent it from being automatically added to other routes
Expand Down