All things Shopify and commerce
Hello everyone, hope you are doing well.
I want to add to the footer of the cart drawer, how much customer save when they have product in their cart. I want the customers to see how much they save for the items thay have in their cart. Who could help me about that?
above subtotal I want to add this. Like Your Savings: XXX EUR
Solved! Go to the solution
This is an accepted solution.
Hi,
I hope you are doing good
The below code snippet can help you
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign saving = item.variant.compare_at_price | minus: item.variant.price | times: item.quantity %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
{% endfor %}
<div class="Savings">Your savings: {{ total_saving | money }}</div>
I hope the this is useful to you.
Thanks!
This is an accepted solution.
Try this
{% assign cart_total = 0 %}
{% for item in cart.items %}
{% assign line_total = item.variant.price | times: item.quantity %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign line_total = item.variant.compare_at_price | times: item.quantity %}
{% endif %}
{% assign cart_total = line_total | plus: cart_total %}
{% endfor %}
<div class="cart-total-wrapper">Total: {{cart_total}}</div>
I hope the above is useful to you.
Thanks!
This is an accepted solution.
Hi,
I hope you are doing good
The below code snippet can help you
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign saving = item.variant.compare_at_price | minus: item.variant.price | times: item.quantity %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
{% endfor %}
<div class="Savings">Your savings: {{ total_saving | money }}</div>
I hope the this is useful to you.
Thanks!
thank you very much, it worked. great. Can you please share if there is any way to show total value without discounts in the footer like above?
Total: {{cart.original_total_price}}
I hope the above is useful to you.
Thanks!
Thank you very much, yes it worked very well. to show the total price in the footer of the cart drawer where can I add " {{cart.original_total_price}} " this code to see it in the footer of the cart drawer. Thanks for your help and support.
<div class="cart-total-wrapper">Total: {{cart.original_total_price}}</div>
You can place it at any place you like in cart footer, for example, below savings etc..
I hope the above is useful to you.
Thanks!
Thank you very much, yes it worked very well, but it shows the total value after cart items discounts, I need to show before cart items discount. Thanks for your support )
This is an accepted solution.
Try this
{% assign cart_total = 0 %}
{% for item in cart.items %}
{% assign line_total = item.variant.price | times: item.quantity %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign line_total = item.variant.compare_at_price | times: item.quantity %}
{% endif %}
{% assign cart_total = line_total | plus: cart_total %}
{% endfor %}
<div class="cart-total-wrapper">Total: {{cart_total}}</div>
I hope the above is useful to you.
Thanks!
Thank you very much, it worked very well
Where you have to add this code?
Where do I have to paste this code?
Hi @AlecH @LoungeWeAre
I hope you are doing well.
You have to add it to place where you want to show cart total or cart saving
It can be above checkout button in cart-drawer.liquid or mini-cart.liquid
OR
If it is cart page then it can be main-cart.liquid or cart.liquid or cart-footer.liquid
It depends upon theme you are using and you should have some knowledge of theme editing in shopify
Please press Like and Mark Solution if you find it helpful.
Thanks!
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025