How to change On sale badge to percentage (Prestige)

Hello I used a code that only changed my on sale badge on homepage to percentage but not the collections pages.

Website: Zoticnewyork.com

HERE ARE EXAMPLE PHOTOS

I want this perctange on sale badge instead of ON SALE>

I want to change on sale badge to percatage of sale like I did to homepage

1 Like

@AMOB

{% assign price = product.selected_or_first_available_variant.price %}
{% assign compare_at_price = product.selected_or_first_available_variant.compare_at_price %}
{% assign discount_percentage = compare_at_price
    | minus: price
    | times: 100.0
    | divided_by: compare_at_price
    %}
-{{ discount_percentage | round: 0 }}% 

Try out this code.

or you can try out this things.

  1. Find a place in the code where ‘Sale’ phrase is used

  2. Replace ‘Sale’ text with this code

 {% if compare_at_price > price %}
 {% assign price_diff = product.compare_at_price | minus: product.price %}
  {{ price_diff | times: 100 | divided_by: product.compare_at_price }} %
 {% endif %}

Both are the working Solution,
Let, me know if you have any Queries.
Thank you.

Can’t figure where the sale code is at

2 Likes

@AMOB

can you please check your theme setting may be allow this if doesn’t so please share code so i will check and update

1 Like

@AMOB
Let me, help you out to fix that code. Share you featured-collection.liquid file code.
Thank you

1 Like

Pretisge has been updated to 7.3.2. How to change savexx badge to xx% off?