How to change the on sale badge to show amount saved

doorstepdrip
Excursionist
43 0 9

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
873 117 126

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

Dan-From-Ryviu
Shopify Partner
7027 1330 1354

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 or Accept solution, - Coffee Tips or Paypal Tips
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- 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 %}