Created
October 24, 2023 07:04
-
-
Save airarm/6ffa86b234c6dba739efab4c562f630b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% assign cart_com_total_price = 0 %} | |
{% for line_item in cart.items %} | |
{% if line_item.product.compare_at_price %} | |
{% assign com_price = line_item.product.compare_at_price | times: line_item.quantity %} | |
{% assign cart_com_total_price = cart_com_total_price | plus: com_price %} | |
{% else %} | |
{% assign cart_com_total_price = cart_com_total_price | plus: line_item.final_price %} | |
{% endif %} | |
{% endfor %} | |
{% if cart_com_total_price > cart.total_price %} | |
{% assign total_price_diff = cart.total_price | minus: cart_com_total_price %} | |
<div> | |
<span style="color:green;">Savings</span> | |
<span style="color:green;">{{ total_price_diff | money }}</span> | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment