Skip to content

Instantly share code, notes, and snippets.

@enamhasan
Created July 20, 2025 15:41
Show Gist options
  • Save enamhasan/ab730c140bb891e72bca7633e07764f6 to your computer and use it in GitHub Desktop.
Save enamhasan/ab730c140bb891e72bca7633e07764f6 to your computer and use it in GitHub Desktop.
Shopify Page redirect multiple
# 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