Skip to content

Instantly share code, notes, and snippets.

@kathy330
Forked from kyleaparker/gist:5949872
Created August 29, 2019 02:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kathy330/e28e9ac435151dd90fe97f059383b290 to your computer and use it in GitHub Desktop.
Save kathy330/e28e9ac435151dd90fe97f059383b290 to your computer and use it in GitHub Desktop.
Shopify - Show total savings on cart page
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% capture saving %}{{ item.variant.compare_at_price | minus: item.variant.price }}{% endcapture %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
...rest of cart code within for loop
{% endfor %}
Display saving:
Saving - {{ total_saving | money }}
@kathy330
Copy link
Author

add to cart.liquid to displage compare_at_price on the cart page.

{% if item.product.compare_at_price > item.price %}<s>{{ item.product.compare_at_price | money }}</s>{% endif %}
{{ item.price | money }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment