You are X away from free shipping notification in cart preview

New Member
30 0 0

I'm trying to get my cart preview to show "You are X away from free shipping" however I don't think that it's pulling that there's a new product being added to the cart so it just stays the original shipping rate. 

This is the code I am using for the cart page but the cart preview (popup when item added to cart) doesn't calculate it correctly. How do I fix this for the preview? 

{% assign shipping_value = 8500 %}
{% assign cart_total = cart.total_price %}
{% assign shipping_value_left = shipping_value | minus: cart_total%}
<p class="shipping-savings-message">
  {% if shipping_value_left > 0 %}
  You are {{ shipping_value_left | money }} away from free shipping!
  {% else %}
    You've qualify for free shipping!
  {% endif %}

www.riotsociety.com

0 Likes
Excursionist
19 0 4

I'm not sure whether it's possible to achieve using just code in Liquid, but we developed an app which does it as a popup – https://apps.shopify.com/free-shipping-popup.

Built more than 10 public Shopify apps for clients, with partners and our own – https://asoft.co
0 Likes