Solved

how to show % discount on a product using debut theme

Lovelyn12
Excursionist
39 1 4

Hello experts,

 

I am using debut theme. May I know how to show % discount on every product. And How to make proper layout of qty and add to cart button on home page. Please help me to fix this.

 

Thank you.

Accepted Solutions (2)

Tejas_Nadpara
Shopify Partner
1118 222 552

This is an accepted solution.

@Lovelyn12 

 

Add following code where you want to display like "17% off" in your product page:

{% if product.compare_at_price_max > product.price %}
{{ 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'}}% off
{% endif %}

Also, I can help you to fix Qty and AddToCart button, just mail me with store details.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on tejas.nadpara@gmail.com regarding any help

View solution in original post

ankur-verma
Shopify Expert
94 19 27

This is an accepted solution.

Hi Lovelyn

You can do it very easily if you can modify the liquid files.
Just login in your shopify admin store. There you will see the option of online store.
Expand it here you will find the menu Theme.
Then from there you can find the option to edit the code and find "product-price.liquid" file.
In that files you can write the code after line number 12 write the below code
{% if compare_at_price %}
{% capture discount %}
{{ compare_at_price | minus:price | times:100 | divided_by:compare_at_price }}%
{% endcapture %}
{{ discount }}
{% endif %}


here {{ discount }} is you % discount you can use at any place in that liquid file.

Please let me know if it was helpful.

View solution in original post

Replies 40 (40)