Created
July 20, 2025 15:41
-
-
Save enamhasan/ab730c140bb891e72bca7633e07764f6 to your computer and use it in GitHub Desktop.
Shopify Page redirect multiple
This file contains hidden or 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
# Add this to your theme.liquid | |
{% if request.path contains '/products/' %} | |
<style>body { display: none; }</style> | |
<script> | |
const redirects = { | |
'/products/the-iron-code': '/pages/the-iron-code', | |
'/products/the-iron-code-beta-pack': '/pages/the-iron-code-beta', | |
'/products/the-gold-standard-beta-pack-1': '/pages/gold-standard' | |
}; | |
const path = window.location.pathname; | |
if (redirects[path]) { | |
window.location.href = redirects[path]; | |
} else { | |
document.body.style.display = ''; | |
} | |
</script> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment