How to add a free shipping progress bar to Shopify without an app
"You're €12 away from free shipping" is one of the simplest ways to lift order value. Here is a section that does it from your theme, with the cart's real total.
Key takeaways
- A free shipping bar only needs the cart total, which Liquid gives you on page load and Shopify's /cart.js gives you after every change.
- The threshold in the bar must match your real free-shipping rate in Shopify's shipping settings, or the bar makes a promise checkout does not keep.
- Updating the bar when items are added without a page reload is done by listening for the theme's cart requests and reading /cart.js again.
- With several currencies or markets, set the threshold per market or show the bar only in your main one.
A free shipping bar tells shoppers how far they are from free delivery and fills up as they add to the cart. It works because it turns a cost into a goal, and stores that use one commonly see larger orders around the threshold. Most stores add it with an app. It does not need one: the bar only has to know the cart total and your threshold, and both are already available to your theme.
How a free shipping bar works in a theme
When a page loads, Liquid knows the cart: cart.total_price is the total in the smallest unit of the currency (cents), and cart.currency.iso_code is the currency. That is enough to draw the bar on every page view. The harder part is updating it when someone adds a product without a page reload, through a cart drawer or a quick-add button. Themes do that with requests to Shopify's cart endpoints (/cart/add, /cart/change, /cart/update), so the section watches for those requests and then reads the new total from /cart.js.
The free shipping bar section
{%- liquid
assign goal = section.settings.threshold | times: 100
-%}
<div
class="fsb"
id="fsb-{{ section.id }}"
data-goal="{{ goal }}"
data-currency="{{ cart.currency.iso_code }}"
data-locale="{{ request.locale.iso_code }}"
{{ section.shopify_attributes }}
>
<p class="fsb__text" aria-live="polite">
<span data-away>{{ section.settings.away_text }}</span>
<span data-done hidden>{{ section.settings.done_text }}</span>
</p>
<div class="fsb__track" aria-hidden="true"><div class="fsb__fill"></div></div>
</div>
<style>
#fsb-{{ section.id }} { padding: 10px 16px; text-align: center; background: {{ section.settings.background }}; color: {{ section.settings.text }}; }
#fsb-{{ section.id }} .fsb__text { margin: 0 0 8px; font-size: 14px; }
#fsb-{{ section.id }} .fsb__track { max-width: 420px; height: 6px; margin: 0 auto; border-radius: 99px; background: rgba(127,127,127,.25); overflow: hidden; }
#fsb-{{ section.id }} .fsb__fill { height: 100%; width: 0; border-radius: inherit; background: {{ section.settings.bar }}; transition: width .5s ease; }
@media (prefers-reduced-motion: reduce) { #fsb-{{ section.id }} .fsb__fill { transition: none; } }
</style>
<script>
(function () {
var root = document.getElementById('fsb-{{ section.id }}');
if (!root || root.dataset.ready) return;
root.dataset.ready = '1';
var goal = +root.dataset.goal;
var away = root.querySelector('[data-away]');
var template = away.textContent;
var money = new Intl.NumberFormat(root.dataset.locale, { style: 'currency', currency: root.dataset.currency });
function draw(total) {
var left = Math.max(0, goal - total);
root.querySelector('.fsb__fill').style.width = Math.min(100, (total / goal) * 100) + '%';
away.textContent = template.replace('[amount]', money.format(left / 100));
away.hidden = left === 0;
root.querySelector('[data-done]').hidden = left > 0;
}
function refresh() {
fetch(window.Shopify && Shopify.routes ? Shopify.routes.root + 'cart.js' : '/cart.js')
.then(function (r) { return r.json(); })
.then(function (cart) { draw(cart.total_price); })
.catch(function () {});
}
draw({{ cart.total_price }});
// Redraw after the theme changes the cart without reloading (cart drawers, quick add).
var send = window.fetch;
window.fetch = function (input) {
var url = typeof input === 'string' ? input : (input && input.url) || '';
var p = send.apply(this, arguments);
if (/\/cart\/(add|change|update|clear)/.test(url)) p.then(function () { setTimeout(refresh, 50); });
return p;
};
window.addEventListener('pageshow', function (e) { if (e.persisted) refresh(); });
})();
</script>
{% schema %}
{
"name": "Free shipping bar",
"tag": "section",
"settings": [
{ "type": "number", "id": "threshold", "label": "Free shipping from", "default": 50, "info": "In your store's currency. Must match your free shipping rate in Settings › Shipping and delivery." },
{ "type": "text", "id": "away_text", "label": "Message before", "default": "You're [amount] away from free shipping", "info": "[amount] is replaced with what is left to spend." },
{ "type": "text", "id": "done_text", "label": "Message after", "default": "You've unlocked free shipping!" },
{ "type": "color", "id": "background", "label": "Background", "default": "#111111" },
{ "type": "color", "id": "text", "label": "Text", "default": "#ffffff" },
{ "type": "color", "id": "bar", "label": "Bar", "default": "#4ade80" }
],
"presets": [ { "name": "Free shipping bar" } ]
}
{% endschema %}How to install it
Duplicate your theme
In Online Store › Themes, open the ⋯ menu on your live theme and choose Duplicate, so you can test on the copy.
Create the section
On the copy, choose ⋯ › Edit code, then under Sections click Add a new section and name it
free-shipping-bar.Paste the code
Replace the file's contents with the code above and press Save.
Add it to the header group
Open Customize. In the header area, choose Add section and pick Free shipping bar, so it sits above every page like an announcement bar. You can also add it to the cart page only.
Set your threshold
Enter the same amount as your free shipping rate, adjust the messages and colours, then add something to the cart in the preview to watch it fill.
Section groups (the header and footer areas of the theme editor) arrived in 2023, so themes older than that may not have them. In that case, add the bar to the cart page template instead, or ask the theme's developer where announcement-style sections go.
Several currencies and markets
If you sell in more than one currency with Shopify Markets, the cart total arrives in the shopper's currency, while the threshold you typed is a single number. The simplest honest set-ups are: show the bar only in your main market (wrap the section's markup in {% if localization.market.handle == 'your-market' %}), or set a free-shipping rate per market and add one bar per market with its own threshold. The section above formats the amount in the cart's currency, so the words are always right; only the number you choose needs to match each market's rate.
What makes a free shipping bar work
- Set the threshold a little above your average order. If most orders are €40, a €50 threshold is reachable with one more item; €100 is not and the bar becomes noise.
- Say the amount, not a percentage. "€8 away from free shipping" is a clear next step.
- Show it where decisions happen: at the top of every page, and again in the cart.
- Celebrate reaching it. The message after should feel like a small win, and the bar should be full.
- Suggest what to add. A product row below the cart with items around the remaining amount turns the goal into a click.
A designed version
For something with more character, Free Shipping Teapot on the marketplace is a top-of-page band that reads the real cart the same way: a glass teapot fills with tea as the bag nears free shipping. It installs as a plain section like the one above. More banners and offers are in the Shopify call-to-action sections, and if you want a bar that matches your brand exactly, describe it to the Shopify Liquid code generator.
Questions, answered
Can I add a free shipping bar to Shopify without an app?
Yes. Paste the section from this guide into a new section file, add it to your header or cart page in the theme editor, and set your threshold. No app or subscription is needed.
Does the free shipping bar update when a product is added to the cart?
Yes. It watches for the theme's cart requests and reads the new total from Shopify's /cart.js, so it updates with cart drawers and quick-add buttons without a page reload.
Does the bar give customers free shipping?
No. Free shipping is a shipping rate you set up in Settings › Shipping and delivery with a minimum order price. The bar shows progress towards it, so both must use the same amount.
Do discounts count towards the free shipping threshold?
The bar uses the cart total after cart discounts. Shopify's minimum-order rates also look at the discounted subtotal, so the two agree in the usual case. Check with a test order if you use unusual discount set-ups.
Can I show the free shipping bar only on the cart page?
Yes. Instead of the header group, add the section to the cart template in the theme editor.