Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How to change the on sale badge to show amount saved

How to change the on sale badge to show amount saved

doorstepdrip
Excursionist
45 0 10

Hey, how can I change the on sale badge to say the amount saved instead please?

my website is: doorstepdrip.com


It currently looks like this:

 

40463890-16A1-466D-A2F2-11CD9D684410.jpeg

 

im hoping to get it to look like this

889DF054-18FE-41CE-98B0-BF2C93F05E9E.jpeg

 

any help would be much appreciated 

thanks 🙂

saon
Replies 3 (3)

websensepro
Shopify Partner
1288 145 166

Hi, @doorstepdrip 

 

Follow these Steps:

1) Go to Online Store
2) Edit Code
3) Find Price.liquid File:

press ctrl+f past this {{ 'products.product.on_sale' | t }}

Replace {{ 'products.product.on_sale' | t }} with the following code:

 

-{{ compare_at_price | minus: price | times: 100 | divided_by: compare_at_price | round }}% OFF

 

 

Need a Shopify developer?
Hire us at WebSensePro
For Shopify Design Changes | Shopify Custom Coding | Custom Modifications
Subscribe to our youtube channel or buy us a Cofee here

Free Shopify Beginner Tutorial

Dan-From-Ryviu
Shopify Partner
10261 2039 2110

Hi @doorstepdrip 

Go to your Online store > Themes > Edit code > open card-product.liquid file, and find this line of code.

{{- 'products.product.on_sale' | t -}}

Replace with this code. 

{%- assign savings = card_product.compare_at_price | minus: card_product.price  -%}
Save £{{ savings | money_without_trailing_zeros }}

 

- Helpful? Like and Accept solution! Or Support me: Buy Coffees
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

mivvael
Visitor
1 0 0

The code you provided will say 0 (local currency) saved. With the following code it does show the amount saved with local currency:

 

{%- assign savings = product.compare_at_price | minus: product.price -%}
{% if savings > 0 %}
  Save {{ savings | money_without_trailing_zeros }}
{% endif %}