Skip to content

Instantly share code, notes, and snippets.

@thenexus00
Created October 19, 2014 22:44
Show Gist options
  • Save thenexus00/05cf8b084bba2d45328e to your computer and use it in GitHub Desktop.
Save thenexus00/05cf8b084bba2d45328e to your computer and use it in GitHub Desktop.
Sign up to different campaigns by detecting what is in the cart
{module_shoppingcartsummary direction="vertical" collection="cartProducts" template=""}
{%if cartProducts.itemCount != 0%}
{% assign isCleanLean = false %}
{% assign isGoodGreenStuff = false %}
{% for collection in cartProducts.items %}
{% if isCleanLean == false and collection.name contains 'Clean Lean' %}
{% assign isCleanLean = true %}
{% endif %}
{% if isGoodGreenStuff == false and collection.name contains 'Good Green Stuff' %}
{% assign isGoodGreenStuff = true %}
{% endif %}
{% endfor %}
{% if isCleanLean == true and isGoodGreenStuff == false %}
<div class="hidden"><input type="checkbox" checked="checked" name="CampaignList_52913"> {%comment%}- Good Green Stuff Teasing-{%endcomment%}</div>
{% elsif isGoodGreenStuff == true and isCleanLean == false %}
div class="hidden"><input type="checkbox" checked="checked" name="CampaignList_52914"> {%comment%}- Clean Lean Protein Teasing -{%endcomment%}</div>
{% elsif isGoodGreenStuff == true and isCleanLean == true %}
div class="hidden"><input type="checkbox" checked="checked" name="CampaignList_52919">{%comment%}- Everything Purchased List -{%endcomment%}</div>
{% endif %}
{%endif%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment