Liquid, JavaScript, themes, sales channels
Hi all, I'm having trouble adding in a conditional check for displaying money saved e.g. only display "You save: $__ (__%)" if the discount is larger than $5. My issue is that "savings" are being showed for products with 5c price differences and ordinarily, I'd just remove the compare at price for these products but our inventory management system overwrites any updates made in Shopify admin.
Here is the code I currently have:
{% if product.price != 0 %} {{ product.price | money }} {% endif %}
<br>
{% if on_sale %}
{% if product.compare_at_price_max > product.price %}
<b style="color: red;">You save {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%</b>
{% endif %}
{% if product.compare_at_price_max > product.price %} <b style="color: red;">({{ product.compare_at_price | minus: product.price | money }}) </b>{% endif %}
{% endif %}
{% endif %}
User | RANK |
---|---|
25 | |
21 | |
8 | |
7 | |
6 |
Explore the 30-30-30 rule, a dynamic social media strategy for new businesses. Learn how t...
By Trevor Sep 20, 2023Discover how to leverage the often overlooked footer of your ecommerce site to gain custom...
By Skye Sep 15, 2023In this blog, we’ll be shining a light on Shopify Partners, Experts, and Affiliates. Who a...
By Imogen Sep 13, 2023