Show percentage discount next to price

Topic summary

A Shopify store owner wants to display percentage discounts next to product prices. Their existing Liquid code briefly appears on page load but then disappears.

Solution provided:

  • Use updated Liquid code in price.liquid and card-product.liquid files that calculates discount percentage using compare_at_price and price variables
  • The code formula: (compare_at_price - price) × 100 ÷ compare_at_price, rounded to show “Save X%”

Implementation details:

  • For Prestige theme: Add code to product-meta.liquid or product-info.liquid for product pages; collection pages can enable this via theme settings
  • For Dawn theme: Insert code below {% render 'price' around line 207 in the card template

Styling adjustments:

  • Color changes: Modify “Sale badge” color scheme in theme settings
  • To display discount inline with price (not below): Add CSS to base.css:
    .card--standard>.card__content .card__information .card-information { display: flex; }
    .card--standard>.card__content .card__information .card-information .price { margin-right: 8px; }
    

Current issue: One user reports the discount percentage appearing below the price instead of inline, awaiting CSS implementation guidance.

Alternatively, apps like Klip Coupons can achieve this without code modifications.

Summarized with AI on October 27. AI used: claude-sonnet-4-5-20250929.

@INKLY if you’re comfortable editing your theme code, you can customize the product price section to calculate and display the percentage off next to the original price—but it does take some Liquid and math logic. Another option is to use an app if you’d rather not deal with code.

For example, Klip Coupons: Sales and Discounts adds a clippable coupon directly on the product page, and when a customer clips it, it can show the discounted price and highlight how much they’re saving (percentage or fixed). It’s a clean way to draw attention to the offer without modifying your theme.

Useful if you’re trying to drive more conversions visually without hardcoding every price change

On the Collections Page, the Discount is appearing on the picture, I want to be seen near the price not on image. Request your help

Also, the product image shows the word SALE which I dont want.

1 Like

Please find this line contains this code around line 515

{% render 'price'

Add this code below it

{%- if card_product.compare_at_price > card_product.price and card_product.available -%}
{%- assign percent = card_product.compare_at_price | minus:card_product.price | times: 100 | divided_by:card_product.compare_at_price | round -%}
Save {{ percent }}%
{%- endif -%}

hi, I added the code however nothing has changed on the Collections page. here’s the screenshot.

1 Like

Could you share the link to your page so I can check?

https://www.stylesang.com/collections

Sorry, my mistake. The code must be added below {% render ‘price’ around line 207

have added the code however its coming in the line below, want it next to price as reference and sale written on top left

Please add the following additional CSS to the base.css file to make them appear on one line.

.card--standard>.card__content .card__information .card-information { display: flex; }
.card--standard>.card__content .card__information .card-information .price { margin-right: 8px; }

Where exactly in the base.css file

From Sales channels > Online Store > Themes > click “…” in Current theme > Edit codes

is this correct? because it did not work