Prestige Theme - I want to show discount percentage after sale price

Topic summary

A user wants to display a discount percentage badge (e.g., “20% off”) next to sale prices on their Shopify store using the Prestige theme.

Solution Provided:
Another participant shared Liquid code that calculates and displays the discount percentage by comparing the original price with the discounted price. The code uses conditional logic to show the percentage only when a discount exists.

Implementation Questions:
The original poster, being new to Liquid, requested clarification on where exactly to paste the code—specifically whether it should go in Product.liquid or Collection.liquid files.

Guidance Given:

  • For product pages: insert code in Product.liquid
  • For collection pages: insert code in Collection.liquid

The discussion remains open as the user seeks more detailed placement instructions within these template files.

Summarized with AI on November 13. AI used: claude-sonnet-4-5-20250929.

Just like the 20% off.
Thank you so much in advance.

My store url is: https://82f00c-3.myshopify.com/

Hi @Sabih_Nawaz

you can place the below code in your product or your collection page.

{% assign original_price = product.price %}
{% assign discounted_price = product.compare_at_price %}

{% if original_price > discounted_price %}
  {% assign discount_percentage = ((original_price - discounted_price) / original_price) * 100 %}
  

{{ discount_percentage | round: 2 }}% off

{% endif %}

Thanks

Hey @Anthony_David_1
Thank you for your response,
could you tell me where to actually paste code in Product.liquid or Collection.liquid

Many Thanks

to show it on product page it will be > Product.liquid and to show it on Collection it would be collection.liquid

could you please tell me where in code actually I’m new to liquid.
Thanks