Add total savings to Subtotal

Hello All,

I know that this is a common topic of discussion but I wanted to see if there was a way to get the compared price above the subtotal in my cart. The image attached is to better explain what I would like help on. I already played around with the CSS for Main-Cart-items.liquid.

I added this code to get it under my actual product -
{% if item.variant.compare_at_price > item.variant.price %}
{{ item.variant.compare_at_price | money }}
{% endif %}

I am curious to see if I could get it on the actual total and subtotal sections. I am using the Shrine Theme currently. I have been trying to find every possible answer to fix this but nothing is helping. I would prefer not to use an app because I would like it to be automatic instead of a having to add a discount code.

My URL is - https://sweet-dreamzzz.com/cart

I would appreciate any help on this.

Thanks,

Sean

Hi @Sean_Morton34 ,

It is possible to do, you can do something like this:

(Note: Please update this code in *.liquid file of cart page)

1/ Calculate total compare price:

{% assign subtotalCompare = 0 %}
{% for item in cart.items %}
  {% if item.variant.compare_at_price > item.variant.price %}
     {% assign subtotalCompare = subtotalCompare | plus: item.variant.compare_at_price %}
  {% endif %}
{% endfor %}

2/ Print total compare price


   {{ subtotalCompare | money }}
 

Hope this helps!

Hi Nvchien!

Thank you! it worked but I wanted to see if there ways a way to get the line through it? Below is what I see now.

Thanks,

Sean

@Sean_Morton34

For line through, you can use tag in html, for example:

<s>
   {{ subtotalCompare | money }}
 </s>

I got it! Thank you so much!

Hi! sorry I tried copying the code you provided in the cart-drawer.liquid

as :

{% assign subtotalCompare = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign subtotalCompare = subtotalCompare | plus: item.variant.compare_at_price %}
{% endif %}
{% endfor %}

{{ subtotalCompare | money }}
{{ subtotalCompare | money }}

but is not working! the price in the landing page still shows the compared price $119 instead of $200, but once I add the product to the cart I do not see the comparison which is not good. I want customers to see that.. any help? thank you @Sean_Morton34

image 1. Showing the cart drawer
image 2. Showing the prices on product page