All things Shopify and commerce
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.
Solved! Go to the solution
This is an accepted solution.
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
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.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024