Skip to content

Instantly share code, notes, and snippets.

@davidbbe
Created October 13, 2014 21:30
Show Gist options
  • Save davidbbe/f86066d0bdf9aa8cdc99 to your computer and use it in GitHub Desktop.
Save davidbbe/f86066d0bdf9aa8cdc99 to your computer and use it in GitHub Desktop.
Math in a Liquid logic statement
{% if product.metafields.preorder.qty && variant.inventory_quantity <= 0 && product.metafields.preorder.qty | plus: variant.inventory_quantity >= 0 %}
Preorders left: {{ product.metafields.preorder.qty | plus: variant.inventory_quantity }}
<input id="add-to-cart" type="submit" class="green-btn" value="Preorder">
{% elsif %}
<input id="add-to-cart" type="submit" class="green-btn" value="Add to Cart">
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment