Skip to content

Instantly share code, notes, and snippets.

@octipus
Created June 12, 2020 15:35
Show Gist options
  • Save octipus/ade5c62f014d742e2f8f7002bf9008c5 to your computer and use it in GitHub Desktop.
Save octipus/ade5c62f014d742e2f8f7002bf9008c5 to your computer and use it in GitHub Desktop.
Shopify Liquid code snipped to calculate and display entitlement for free shipping ---- ideally to be displayed on the cart page - or anywhere :)
//Shopify Liquid code snipped to calculate and display entitlement for free shipping
//ideally to be displayed on the cart page - or anywhere :)
{%- assign freeShippingAmount = 60 | times:100 -%}
{%- assign cartTotalDiff = freeShippingAmount | minus:cart.total_price -%}
{%- if cart.total_price < freeShippingAmount -%}
<h4>Almost there! <br> Add {{ cartTotalDiff | money }} more to your cart for free shipping</h4>
{%- elsif cart.total_price >= freeShippingAmount -%}
<h4> Congratulations! You now have Free Shipping </h4>
{%- endif -%}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment