# Re: percentage off on sale badge

Solved

## How can I round off sales badge percentage to the nearest 5?

Tourist
6 0 2

I have the percentage off listed on my sales badges for products. My question is, how can I get that percentage to round up or down in 5's?

Example:

12% off will be listed as 10%

14.7% will list as 15%

My code currently is as follows:

{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | round}}% OFF
</span>

Accepted Solution (1)
Shopify Partner
325 47 76

This is an accepted solution.

Hey @kathi8171

``````{%- if show_badges -%}
{%- assign discount = product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max -%}
{%- assign rounded_discount = discount | divided_by: 5 | round | times: 5 -%}
{{ rounded_discount }}% OFF
</span>
{%- endif -%}``````
Azam Gill
- Encourage me ❤️

Come and visit us at Wbify
Replies 2 (2)
Shopify Partner
325 47 76

This is an accepted solution.

Hey @kathi8171

``````{%- if show_badges -%}
{%- assign discount = product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max -%}
{%- assign rounded_discount = discount | divided_by: 5 | round | times: 5 -%}
{{ rounded_discount }}% OFF
</span>
{%- endif -%}``````
Azam Gill