Last active
August 29, 2015 14:24
-
-
Save stewartknapman/0499976331e5ff5f0d7d to your computer and use it in GitHub Desktop.
This file contains 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
{% comment note: | |
We do not want certain products to be available as a standard product with the standard template so SHUT IT DOWN! | |
http://media1.giphy.com/media/bMza4SFYBEb8k/giphy.gif | |
If the product has been given the 'bundle-only' template as its default then find its appropriate (or first) bundle collection | |
and redirect the user to go to there. | |
%}{% endcomment %} | |
{% assign redirect_url = false %} | |
{% assign bundle_templates = 'sixpack,bundles,planbuilder' | split: ',' %} | |
{% if product.template_suffix == 'bundle-only' %} | |
{% for collection in product.collections %} | |
{% for bundle_template in bundle_templates %} | |
{% if collection.template_suffix contains bundle_template and redirect_url == false %} | |
{% assign redirect_url = collection.url %} | |
{% endif %} | |
{% endfor %} | |
{% endfor %} | |
{% endif %} | |
{% if redirect_url %} | |
<script type="text/javascript"> | |
window.location = '{{ redirect_url }}'; | |
</script> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment