Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi, I'm working on editing our order confirmation emails. I'd like the compare at price to show beside line items that are on sale (variant compare at price is > variant price). However, I can't quite figure it out. This is what I have so far, which I know isn't quite right
<td class="order-list__price-cell">
{% if line.variant.compare_at_price != line.final_line_price %}
<del class="order-list__line.variant.compare_at_price">{{ line.variant.compare_at_price | money }}</del>
{% endif %}
This displays like this:
This will show the compare at price for the variant for sale items (this is what I want), but this only works if there is a quantity of 1 of the line item. If there is a quantity of 2 for the line item, then the compare at price will show regardless of whether its on sale or not. This is because "line.final_line_price" adds together the price for all the units in that line. I tried using "variant.price" but that gives an error.
Can anyone help with what I'm hoping to do?
I would also love to put either "each" or "x [qty]" after the strikethrough compare at price so that its clear that that number is per unit. But that's a bonus if I can figure out the first part.
I managed to figure out the first part of my question. The correct code is
<td class="order-list__price-cell">
{% if line.variant.compare_at_price != line.price %}
<del class="order-list__line.variant.compare_at_price">{{ line.variant.compare_at_price | money }}</del>
Now its just the second part of my question that I'm still struggling with. How to put either "each" or "x [qty]" after the strikethrough compare at price so that its clear that that number is per unit. If anyone knows how to tack that on, I'd love your help. The part I'm stuck on is to have it NOT display on regular priced items. Right now, when I add the text, it adds it for all items on the order, not just the ones that are displaying the compare at price.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025