Skip to content

Instantly share code, notes, and snippets.

@nrkn
Forked from holdinghandsfeedingducks/price-sale.liquid
Last active July 18, 2017 04:12
Show Gist options
  • Save nrkn/11c3c99e988ed2c87c6a77020c5a7b3a to your computer and use it in GitHub Desktop.
Save nrkn/11c3c99e988ed2c87c6a77020c5a7b3a to your computer and use it in GitHub Desktop.
{% assign saved_amount = compare_price | minus: product_price %}
{% comment %}
Unless this store uses multiple currencies,
we will remove the decimals when they are equal to 00,
or when the amount is > 10 (dollars, pounds, etc.).
{% endcomment %}
<!-- using expected price-sale template -->
{% if shop.money_format contains 'money' %}
{% assign saved_amount = saved_amount | money %}
{% else %}
{% assign saved_amount = saved_amount | money_without_trailing_zeros %}
{% endif %}
{{ 'products.general.save_html' | t: saved_amount: saved_amount }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment