A user working with Shopify’s Sense theme needed help displaying dynamic discount percentages on products, rather than manually entering a fixed value like “33%” for each item.
Solutions provided:
prakashVt shared Liquid code that calculates discount percentage by comparing product.compare_at_price to product.price
Dan-From-Ryviu provided a more specific solution: editing the price.liquid file and replacing the static sale text with dynamic percentage calculation code
This solution was confirmed working by multiple users
Extended troubleshooting:
For users on the Atelier theme, different files needed modification:
Edit product-card-badges.liquid to show percentages on collection pages
Add code to price.liquid (before the last </div>) to display discount badges on individual product pages
Outcome: The discussion reached full resolution with working code snippets for both the Sense and Atelier themes. Users successfully implemented dynamic discount percentage displays across collection and product pages.
Summarized with AI on October 24.
AI used: claude-sonnet-4-5-20250929.
Hello, as you can see from the screenshots above that I can edit what is shown for products on sale. My question is, what should I enter instead of “33” for the site to calculate the discounted value as I am not willing to make each product on 33% sale.
Hey i am using Atelier theme and i am not able to find this {{ ‘products.product.on_sale’ | t }} line in my price.liquid snippet as there is only 79 line of code it self as this is diffrent theme i guess there if few diffrent thing i have also gone through the code but didnt find any if anyone have any clue kindly help me with that.
thankyou
Yes, it worked! Thank you so much — I had been trying to fix this for the past two weeks and couldn’t find a solution anywhere. Your guidance really helped me and solved the issue right away.
If you don’t mind me asking, I just noticed that the sale badge shows only on the product collection page, but not on the individual product page. I’d like it to appear there as well, ideally right after the price section. Could you please suggest which .liquid file I should work on to make that change?