Last active
August 29, 2015 14:04
-
-
Save zakhardage/c499672174e573efa240 to your computer and use it in GitHub Desktop.
Inventory for Wholesale [Shopify]
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
| {% for variant in product.variants %} | |
| {% assign qty = qty | plus:variant.inventory_quantity %} | |
| {% endfor %} | |
| {% if qty > 0 %} | |
| <label>Quantity ({{ qty}} available):</label> | |
| <input type="text" name="quantity" id="quantity" value="1" onclick="this.select()" onkeyup="qtyCheck(this.value)" /> | |
| <button type="submit">add to cart</button> | |
| {% else %} | |
| <p>Sorry, this is temporarily unavailable.</p> | |
| {% endif %} | |
| <script> | |
| function qtyCheck(qty) { | |
| if(qty > {{ qty }}) { | |
| alert("Sorry, we only have {{ qty available }}."); | |
| document.getElementById('quantity').value = "{{ qty }}"; | |
| } | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment