Skip to content

Instantly share code, notes, and snippets.

Last active August 4, 2020 22:24
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Shopify Homepage Redirect

Shopify Homepage Redirect

Use the "Custom Content" section in a debut theme to add a code block with the contents of shopify-redirect.js. This will allow you to create a user-editable redirect. The code is wrapped in an iFrame check so the redirect is not triggered while in the editor. Editors can toggle the redirect on/off by showing/hiding that section.

function inIframe () {
try {
return window.self !==;
} catch (e) {
return true;
if (!inIframe()) {
} else {
if (document.currentScript) {
var script = document.currentScript
script.parentNode.innerHTML = '<p>This page redirects to <code>/collections/all</code>. To disable the redirect, hide the "Custom Content" section.</p>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment