Shopify themes, liquid, logos, and UX
Hi Legends, i hope everyone is doing great..
I need a small help..
Iam using Dawn theme..and if a product is on sale it just shows as sale.. but how can i show the % on the badge as well?
any help would be appreciated..:)
Thanks in advance:)
{% 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 %}
@saitejabandaru
try this code in the Product-template.liquid file.
it show the % and the remaining will be the custom code where you want to Display this into your Product.
Thanks for the reply @Zworthkey
I actually want it to appear on all of sales badges..home page ..product recommendations..how can i do that and wher can i paste the code ?
it's total customization work. and on which products you want to show the badges.
how much % like '10% save' .
For all this it takes time and you need a Developer for this.
or hire Someone to add these features into store. let me know if you need help from us.
We are always happy to help you.
Thank you.
Hi @saitejabandaru ,
To implement this you have to update the code for card-product.liquid to show impact globally.
Please refer the below code to implement the same.
{%- assign difference = card_product.compare_at_price | minus: card_product.price -%}
{%- assign float_difference = difference | times: 1.0 -%}
{%- assign discount_fraction = float_difference | divided_by: card_product.compare_at_price -%}
{%- assign discount_percentage = discount_fraction | times: 100 | round -%}
{{- discount_percentage }}
For line number where to update the code and implement it on product page kindly refer the below video.
Hope this will helps..
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024