Only display discount value if above a certain amount

Valkyriak
Visitor
1 0 0

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 %}

 

Replies 0 (0)