How To Show Discount on Product Page

Topic summary

A user seeks help displaying discount percentages on their Shopify product pages.

Proposed Solution:

  • Another participant provides Liquid code that calculates and displays the discount percentage by comparing product.compare_at_price with product.price
  • The code snippet is intended for insertion into the product template liquid file

Current Status:

  • The suggested code does not work for the current variant
  • The issue remains unresolved, with the original poster indicating the solution fails when applied to product variants
  • No alternative solutions or troubleshooting steps have been offered yet
Summarized with AI on November 9. AI used: claude-sonnet-4-5-20250929.

I want to add the discount percentage on product page. Please suggest the solution.

https://taoparis.in/collections/heels/products/may-tao-paris-heels?variant=42442750460100

Hi @Mukuldm

I’m not sure what your product template liquid file name is, but if you know the file’s name, you can use this code to display the discount percentage on it.

{% if product.compare_at_price_max > product.price %}
{{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}% OFF
{% endif %}
1 Like

not working for current variant.