How do I add percentage discount to collection page(Debut theme)?

Solved
tinaomi
New Member
6 0 0

Hi Shopify Community,

I would like the products on my collection page to show the percentage and price discount below the compare-to sale price. I followed the instructions in another post but it's not working for me.

I added the below code to Snippets>products-price.liquid at the very end just above </dl> and it's showing only on the product page and not on the collection page. 

{% if product.compare_at_price_max > product.price %}You save {{ current_variant.compare_at_price | minus: current_variant.price | times: 100.0 | divided_by: current_variant.compare_at_price | truncate: 5, "" }}%{% endif %}

{% if product.compare_at_price_max > product.price %} ({{ current_variant.compare_at_price | minus: current_variant.price | money }}){% endif %}

I've attached pictures of how it looks like on the product page and where I'd also like it to appear on the collection page. Does anyone know how to fix this issue? Thanks in advance. 

percentage & price discount on product pagepercentage & price discount on product pagewhere i'd like it to appear on collection pagewhere i'd like it to appear on collection page

0 Likes
Pallavi
Shopify Expert
2220 362 473

This is an accepted solution.

Hello There, 

1. Go to Online Store->Theme->Edit code
2. Asset->snippets/product-price-listing.liquid->paste bellow code after price

{% if product.compare_at_price_max > product.price %}
You save {{ product.compare_at_price_max | minus: product.price | times: 100.0 | divided_by: product.compare_at_price_max | money_without_currency | times: 100 | remove: '.0'}}%
{% endif %}
{% if product.compare_at_price_max > product.price %} ({{ product.compare_at_price | minus: product.price | money }}){% endif %}

Want to modify or develop new app, Hire us.
If helpful then please Like and Accept Solution .
Email: support@zestard.com
Shopify Apps URL :- https://apps.shopify.com/partners/zestard-technologies
Custom Modifications Into Shopify Theme | Shopify Private App | SEO & Digital Marketing
tinaomi
New Member
6 0 0

Thank you so much! That worked perfectly.

0 Likes
DorisChio
New Member
1 0 0

Where exactly is “ after price”?

 

Thank you.

0 Likes
Varun22
Tourist
17 0 2

What exactly after price means ?

0 Likes