Hey @Tara123 ,
Please follow the following steps:
-
Go to your online store and select Themes from left panel
-
Press 3 dots menu in center (on the left of Customize button) and then Edit Code
-
Open the file price.liquid (you can search for it)
-
In that file comment the code which currently displays the SALE badge, and instead add code for discount.
Basically find this code
{{ ‘products.product.on_sale’ | t }}>
And replace it with this (as shown in picture)
{%- if compare_at_price > price -%}> {% assign discount = compare_at_price | minus: price | times: 100.0 | divided_by: compare_at_price | round %}> > {{ discount }}% OFF> > {% endif %}> > {% comment %}> > {{ ‘products.product.on_sale’ | t }}> > {% endcomment %}
After you do that you will be able to see something like this on your product page
Thanks
Yash Garg