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 %}
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.
I'm guessing it's the top line that says 8500%. Mine is for $50 or more. Mine works. It looks like this:
{% assign shipping_value = 5000 %}
{% 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! <a href="/collections/all">Continue shopping</a> to add more products to your cart and receive free shipping for orders over $100.
{% else %}
You've got free shipping!
{% endif %}
</p>
User | Count |
---|---|
520 | |
210 | |
129 | |
79 | |
45 |