Created
March 15, 2014 19:12
-
-
Save zakhardage/9572288 to your computer and use it in GitHub Desktop.
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
| {% if customer and customer.tags contains 'wholesale' %}{% assign wholesale-customer = true %}{% endif %} | |
| {% for variant in product.variants %}{% if variant.title contains 'wholesale' %}{% assign wholesale-product = true %}{% endif %} | |
| {% assign price = product.price_max %} | |
| {% if wholesale-customer and wholesale-product %} | |
| {% for variant in product.variants %} | |
| {% if variant.title contains 'wholesale %} | |
| {% assign item-count = item-count | plus:1 %} | |
| {% unless variant.price < price %} | |
| {% assign id = variant.id %} | |
| {% endunless %} | |
| {% endif %} | |
| {% endfor %} | |
| {% else %} | |
| {% for variant in product.variants %} | |
| {% unless variant.title contains 'wholesale %} | |
| {% assign item-count = item-count | plus:1 %} | |
| {% unless variant.price < price %} | |
| {% assign id = variant.id %} | |
| {% endunless %} | |
| {% endunless %} | |
| {% endfor %} | |
| {% endif %} | |
| {% if item-count > 1 %} | |
| <select name="id" id="product-select"> | |
| {% for variant in product.variants %} | |
| {% if wholesale-customer and wholesale-product %} | |
| {% if variant.title contains 'wholesale' %} | |
| <option value="{{ variant.id }}">{{ variant.title }}</option> | |
| {% endif %} | |
| {% else %} | |
| {% unless variant.title contains 'wholesale' %} | |
| <option value="{{ variant.id }}">{{ variant.title }}</option> | |
| {% endunless %} | |
| {% endif %} | |
| {% endfor %} | |
| </select> | |
| {% else %} | |
| <input type="hidden" name="id" id="product-select" value="{{ id }}" /> | |
| {% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment