What's your biggest current challenge? Have your say in Community Polls along the right column.

Display Compare at price/saving on the Cart and Checkout

Display Compare at price/saving on the Cart and Checkout

giuly
Visitor
3 0 0

Hi,

I have applied a compare at price on my product, I'd like to display the previous price and the total saving on the cart page and on the checkout page, as currently it is showing only the discounted price, but without reminding the customer about the saving he/she is having.

 

Would you please help me find the code to do this, and also give me the instructions on specifically where to insert this code, both for the checkout page and for the cart page?

 

 

Replies 14 (14)

gina-gregory
Shopify Partner
742 51 213

This can be easily done on the cart page, but can only be done in checkout if you're on Shopify Plus.

For the cart page, find where the current item price is and update to something like this:

{{ item.final_price | money }}
{% if item.variant.compare_at_price > item.variant.price %}
  <s>{{ item.variant.compare_at_price | money }}</s>
{% endif %}
gina-gregory
Shopify Partner
742 51 213

For savings, you can calculate like this:

{% assign savings = item.variant.compare_at_price | minus: item.final_price %}
You're saving {{ savings | money }}!
giuly
Visitor
3 0 0

Hi Gina,

Thank you for your help!

Can you please confirm where the code should be placed on the Edit Code section? (e.g. Snippets)

Thanks,

Giulia

gina-gregory
Shopify Partner
742 51 213

My example wouldn't be an exact copy/paste situation. The code and where to put it on the cart template would depend on how your theme is built.

AMPOUR
Tourist
3 0 1

but where can this be placed ? 

 

wadhwatul
Visitor
3 0 0

item.final_price is not working so I changed this to cart.total_price which called the value but I am unable to call value for item.varian.compare_at_price. What am I doing wrong?

giuly
Visitor
3 0 0

Thank you for your help!

Can you please confirm where the code should be placed on the Edit Code section? (e.g. Snippets)

Thanks,

Giulia

 

Margarita111
Visitor
1 0 0

Can this be done to the cart drawer that pops up when something is added to cart?

coljung2
Tourist
4 0 1

'This can be easily done on the cart page, but can only be done in checkout if you're on Shopify Plus.'

Any pointers as to how to achieve this in the checkout page? I'm playing with the script but havent managed to do this yet.

AMPOUR
Tourist
3 0 1

but which file please ? thanks

 

Johnny111
Visitor
3 0 0

should i place it at the end of the code?

Shivu
Shopify Partner
2 0 0

Thank you

SleepNap
Visitor
1 0 0

Please help. I'm using the impact theme and copy/paste it in price-list.liquid but it doesnt work

 

farreal
Shopify Partner
12 0 5

Anyone looking for a solution to this can be found on this thread 

 

https://community.shopify.com/c/technical-q-a/display-compare-at-price-on-checkout-page/td-p/1355520

 

YW 😄