how to show % discount on a product using debut theme

Solved
Highlighted
Excursionist
39 1 2

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.

0 Likes
Highlighted
Shopify Partner
918 195 357

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 support@hexaecommerce.com regarding any help
1 Like
Highlighted

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.

1 Like
Highlighted
Excursionist
39 1 2

Thank you so much. 

 

www.boutq.com store url.

I already add the code on product.price.liquid, but as I go to home page there is not % discount display on each product.

0 Likes
Highlighted
Tourist
6 0 1

May i know in which section code should i apply this on ?

1 Like
Highlighted
Shopify Partner
918 195 357

@TBD19 

 

If you want display discount on product page then add code in Sections > product-template.liquid file

and, If you want to display it on collection page products then add code in Assets > product-price.liquid file

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
1 Like
Highlighted
Tourist
6 0 1

Hi, 

 

Thanks for reaching out to me, 

I tried as you have mentioned but nothing happened in the page. I Could not find the Product-price.liquid file in the assets. 

Sections > product-template.liquid file - I pasted the code in the bottom of the file and saved,

Please refer the attachment code.png

Thanks

Vishnu

0 Likes
Highlighted
Shopify Partner
918 195 357

@TBD19 

 

Send my your store url so, I can check and assist you better.

 

Thank you,

Tejas

Shopify Expert | Skype: tejas.nadpara
- Like and Mark as an Accepted Solution if reply helpful
- Feel free to contact me on support@hexaecommerce.com regarding any help
0 Likes
Highlighted
Tourist
6 0 1

Here's the url www.thebigdealstore.in

 

Thanks

Vishnu

0 Likes
Highlighted
Shopify Partner
918 195 357

@TBD19 

 

I checked and seems like working fine. Check this product https://thebigdealstore.in/products/faded-salmon-evening-wear-gown

It's showing "50% off"

discount.png

 

Let me know if you are looking for something else.

 

Thank you,

Tejas

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