Solved

How To Show % Discount On A Product - Sense theme

-ATT-
Visitor
2 0 0

ATT_0-1709614897417.pngATT_1-1709614930878.png

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.

 

Accepted Solution (1)

Dan-From-Ryviu
Shopify Partner
7538 1454 1452

This is an accepted solution.

Hi @-ATT- 

Dan here from Ryviu: Product Reviews & QA app.

Please visit your Online Store > Themes > Edit code > open price.liquid file, find this line of code 

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

Replace it with this. 

{%- assign percent = product.compare_at_price | minus:product.price | times: 100 | divided_by:product.compare_at_price | round -%}
{{ percent }}% SALE

- Helpful? Like or Accept solution! - Buy me a coffee
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look
- Enjoy 1 month of Shopify for $1. Sign up now

View solution in original post

Replies 4 (4)

BrainStation23
Shopify Partner
260 43 41

Hello @-ATT- 
You can watch this video to set discount 
https://www.youtube.com/watch?v=di2O_H1KRdY&t=25s

Brain Station 23 PLC
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
Email: js.team@brainstation-23.com

prakashVt
Shopify Partner
95 9 16

Hello @-ATT- 

You need to add this liquid code if it is not available on your product page 

{% if product.compare_at_price > product.price %}
{% assign discount_percentage = product.compare_at_price | minus: product.price%}
{% assign discount_percentage = discount_percentage | times: 100 %}
{% assign discount_percentage = discount_percentage | divided_by: product.compare_at_price %}

<p>{{ discount_percentage }}% off</p>

{% endif %}

 

prakashVt_0-1709617140805.png

See the above image. I tried and it works well. You may need to apply CSS based on your requirement. 

- Did you find my response useful? Mark it as "Accepted solution"; so others can see it, or just like it.
- VTN Power Wishlist Looking for a Wishlist App for your store? Check this app with the free plan available.
- Feel free to Contact me

Dan-From-Ryviu
Shopify Partner
7538 1454 1452

This is an accepted solution.

Hi @-ATT- 

Dan here from Ryviu: Product Reviews & QA app.

Please visit your Online Store > Themes > Edit code > open price.liquid file, find this line of code 

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

Replace it with this. 

{%- assign percent = product.compare_at_price | minus:product.price | times: 100 | divided_by:product.compare_at_price | round -%}
{{ percent }}% SALE

- Helpful? Like or Accept solution! - Buy me a coffee
- Ryviu - Product Reviews app, collect product reviews, import reviews from AliExpress, Amazon, Etsy, Shopee and Walmart and CSV.
- Lookfy app: Easy and fast to create Photo Gallery, Lookbook, Shop The Look
- Enjoy 1 month of Shopify for $1. Sign up now

-ATT-
Visitor
2 0 0

Thank you so much! Things from older forums have changed so much that I could get none to work, but this did it!