Created
July 18, 2017 03:41
-
-
Save holdinghandsfeedingducks/134525f0b18c04ee1be69d8d6728ac8b to your computer and use it in GitHub Desktop.
This file contains 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
{% 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 %} | |
{% if shop.money_format contains 'money' %} | |
{% assign saved_amount = saved_amount | money %} | |
{% else %} | |
{% if saved_amount > 1000 %} | |
{% if shop.money_format contains '{{amount}}' and shop.money_format contains '.' %} | |
{% assign saved_amount = saved_amount | money_without_trailing_zeros %} | |
{% elsif shop.money_format contains '{{amount}}' %} | |
{% assign saved_amount = saved_amount | money | split: '.' | first %} | |
{% elsif shop.money_format contains '{{amount_with_comma_separator}}' %} | |
{% assign saved_amount = saved_amount | money | split: ',' | first %} | |
{% else %} | |
{% assign saved_amount = saved_amount | money_without_trailing_zeros %} | |
{% endif %} | |
{% else %} | |
{% assign saved_amount = saved_amount | money_without_trailing_zeros %} | |
{% endif %} | |
{% endif %} | |
{{ 'products.general.save_html' | t: saved_amount: saved_amount }} | |
{% comment %} | |
{% if compare_price > product_price %} | |
Save {{ compare_price | minus: product_price }}% | |
{% endif %} | |
{% endcomment %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment