Show % of discount

Solved
Highlighted
New Member
2 0 0

Hi 

Can anyone help me on how to show the % of discount on debut , I did try and search the forum and found some articles with some code to add to liquid but it does not work for 

me and keep giving me errors when adding , hopefully someone will know how to fix this . 

 

Thank you in advance 

0 Likes
Highlighted
Tourist
12 0 3

Just off the top of my head without looking at Debut, try something like this:

{% assign discount_percentage = product.price | times: 100  | divided_by: product.compare_at_price %}
{{ discount_percentage }}% Off
0 Likes
Highlighted
Shopify Partner
2294 116 341

https://shopify.dev/tutorials/develop-theme-discounts

https://shopify.dev/docs/themes/liquid/reference/objects/discount-allocation

after order placed https://shopify.dev/docs/themes/liquid/reference/objects/discount-application

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
Highlighted

This is an accepted solution.

Hi @albertohloco 

Please try with this code

{%if product.compare_at_price > product.price%}
			{{ product.compare_at_price | minus: product.price | times: 100 | divided_by: product.compare_at_price | append: "% OFF"}} 
        {%endif%}

You need to paste this code here https://prnt.sc/tiuj3l (look at my screenshot)

And here's the result for example https://prnt.sc/tiujpi  

 

Besides this, I have a guide about the product page that provides some tips to increase sales and conversion rate, and if you are interested in, you can check it too.

I hope this will help you. Like it if you find it helpful or mark as the solution. 

Cheers!

- Tips to optimize website loadspeed: academy.pagefly.io/how-to-speed-up-website

- Do you need to customize your landing page, product page, blog, coming soon, FAQ, about us pages? Check out PageFly - Advanced Shopify Page Builder.
2 Likes
Highlighted
New Member
2 0 0

Thank you so much  ! it worked perfect, by any chance you know any way of modifying how the tag looks like , like to put it within a box ? 

I will do my research anyway , thanks again ! 

0 Likes
Highlighted

Hi @albertohloco 

Can you give me your store URL? and any screenshot from your request so I can check it? Thank you. 

- Tips to optimize website loadspeed: academy.pagefly.io/how-to-speed-up-website

- Do you need to customize your landing page, product page, blog, coming soon, FAQ, about us pages? Check out PageFly - Advanced Shopify Page Builder.
0 Likes