Searching Open Sourcery

Type to search Open Sourcery.

Commerce

Cart Progress Bar

A free-shipping threshold bar with currency formatting and themeable fills.

v2.0.0@magic-spells/cart-progress-bar

$ npm i @magic-spells/cart-progress-bar

GitHubnpm

Live demo

Your cart

$24.00Free shipping at $75.00

Try it live — the bar filling toward the threshold as the total climbs.

About

A beautiful, accessible cart progress bar web component for free shipping thresholds and e-commerce sites.

Features

  • 🎯 Smart Messaging - Template-based messages with an [amount] placeholder
  • 🎨 Simplified Theming - Just 6 CSS variables to control all colors and appearance
  • 📱 Responsive - Mobile-optimized with responsive breakpoints
  • ⚡ Smooth Animations - Buttery smooth transitions and completion effects
  • 🔧 Easy Integration - Drop-in web component that works with any framework

Usage

<cart-progress-bar
	threshold="75.00"
	current="25.50"
	message-above="🎉 Congratulations! You've qualified for FREE shipping!"
	message-below="Add $[amount] more for FREE shipping!">
	<p data-content-cart-progress-message>Add $[amount] more for FREE shipping!</p>
	<progress-bar></progress-bar>
</cart-progress-bar>

Attributes

AttributeDescriptionExample
thresholdThreshold amount for free shipping"75.00"
currentCurrent cart amount"25.50"
message-aboveSuccess message when threshold is reached"🎉 FREE shipping unlocked!"
message-belowMessage template shown below the bar"Add $[amount] more!"
money-formatShopify money format string; uses {{amount}} placeholders and formats the amount that fills [amount] in the messages"${{amount}}"
listen-selectorclosest() selector for the element to listen on"cart-panel" (default)
listen-eventEvent name to listen for on that element"cart-panel:data-changed" (default)

About, features, usage and options are taken from the package README.