Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save davidbiehl/483c57d88a5561cb5778 to your computer and use it in GitHub Desktop.
Save davidbiehl/483c57d88a5561cb5778 to your computer and use it in GitHub Desktop.
An HTML/Javascript code snippet for Ecwid to show a simple promo message popup on the cart page for orders less than the defined subtotal
<!-- An HTML/Javascript code snippet for Ecwid to show a simple promo message popup on the cart page for orders less than the defined subtotal -->
<script>
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
var promoMessage = "Orders $99 and up ship free!";
var minSubtotal = 99;
var checkSubtotal = function(order) {
if (order) {
var subtotal = order.total - order.shipping - order.tax;
if (subtotal < minSubtotal) {
alert(promoMessage);
}
}
}
Ecwid.OnPageLoaded.add(function(page) {
if ('CART' == page.type) {
Ecwid.Cart.calculateTotal(function(order) {
checkSubtotal(order);
});
}
});
});
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment