How to show compare price on shopping cart total

Topic summary

Goal: show compare price (original price) next to the current price on the cart item’s right side, and display the old total alongside the discounted total on the cart page.

Update: A JavaScript approach added in theme.liquid did not work; Shopify prevents price changes via JS. Theme code edits are required.

Item-level display: Edit main-cart-items.liquid. Remove the existing price-compare section starting from product-option, then in cart-item__totals (right, small-hide / medium-hide / large-up-hide) render compare_at_price Ă— quantity with a strikethrough when compare_at_price > 0.

Cart totals: In main-cart-footer.liquid, compute an actual-total by summing compare_at_price Ă— quantity (if available) otherwise original_line_price. If actual-total differs from cart.total_price, show the old total with a strikethrough above the current totals.

Alternative totals block: Another provided snippet computes actual_total similarly and displays a “Total Savings” section with the amount.

Notes: Attached images illustrate exact code insertion points; code snippets are central to implementation.

Status: No confirmation of success yet; theme code changes are needed. The discussion remains open.

Summarized with AI on December 21. AI used: gpt-5.

Hi,

2 questions:

-If you add something to my cart, the prices are twice visible, under the product title and then right of it again. I just want it to show compare price and new price on the right side.

-second question, how do I make the old total and new total visible on the cart page. I want customers to see what they were originally paying.

bundoshop.nl

In the first question, did you mean like in the image?

yes this looks good, but I also want the “Totaal” to show compare price! tnx!

I understand. The first request is easy. I will provide you with the code and instructions for it. If it doesn’t perform well, we may need to make changes in the theme code.

For your second request, changes are needed in the theme code. Hire a developer for this. If have any questions let me know so I can clarify, and if not, and you’d like to work together please feel free to message me directly

Please add this code to your theme.liquid file, after element in Online Store > Themes > Edit code


Did not work sir

I’m sorry. We can’t make price changes with Javascript; Shopify prevents this. I just learned about it. We need to make changes in your theme code. If have any questions let me know so I can clarify, and if not, and you’d like to work together please feel free to message me directly.

Please follow below instructions to achieve this. Please feel free to contact us if you have any queries.

  1. Go to “Online Store” → “Themes”.

  2. Select Edit code.

  3. Go to “main-cart-items.liquid” file. Find price-compare and remove the section starting from product-option.

  4. Find “cart-item__totals right small-hide” section and “cart-item__totals right medium-hide large-up-hide” and paste below code like in the attached images.
    {% if item.product.compare_at_price > 0 %}
    {{ item.product.compare_at_price | times: item.quantity | money }}
    {% endif %}

  1. Go to “main-cart-footer.liquid” and paste the below code before the line “
    ” as like in the attached image.

{% assign actual-total = 0 %}
{%- for item in cart.items -%}
{% if item.product.compare_at_price > 0 %}
{% assign total_compare_price = item.product.compare_at_price | times: item.quantity %}
{% assign actual-total = actual-total | plus: total_compare_price %}
{% else %}
{% assign actual-total = actual-total | plus:item.original_line_price %}
{% endif %}
{% endfor %}
{% if actual-total != cart.total_price %}

{{ actual-total | money }}

{% endif %}

1 Like

This Is Working Code

{% assign actual_total = 0 %}
{%- for item in cart.items -%}
{% if item.product.compare_at_price > 0 %}
{% assign total_compare_price = item.product.compare_at_price | times: item.quantity %}
{% assign actual_total = actual_total | plus: total_compare_price %}
{% else %}
{% assign actual_total = actual_total | plus: item.line_price %}
{% endif %}
{% endfor %}

{% if actual_total != cart.total_price %}

Total Savings

{{ actual_total | money_with_currency }}

{% endif %}
1 Like