Forked from makfruit/ecwid_free_shipping_promo_in_cart.html
Last active
March 22, 2016 14:03
-
-
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
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 - 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