Last active
March 22, 2016 14:06
-
-
Save makfruit/6698382 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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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; | |
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
The tax also needs to be removed for an accurate subtotal. See this fork for more details.