Skip to content

Instantly share code, notes, and snippets.

@thadallender
Last active August 29, 2015 14:00
Show Gist options
  • Select an option

  • Save thadallender/11051590 to your computer and use it in GitHub Desktop.

Select an option

Save thadallender/11051590 to your computer and use it in GitHub Desktop.
Volume discounts for Sell Media. Please note: Sell Media verifies the total cost of items from the database right before sending the order to the payment gateway. Comment out lines 200-232 in sell-media/sell-media.js to disable server-side price verification.
sellMediaCart.total = function(){
var total = 0;
sellMediaCart.each(function (item) {
total += item.total();
});
// take 10 off it qty is greater than or equal to 5
if ( sellMediaCart.quantity() >= 5 ){
total -= 10;
// take 4 off it qty is greater than or equal to 3
} else if ( sellMediaCart.quantity() >= 3 ){
total -= 4;
// otherwise, no discount
} else {
total -= 0;
}
return total;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment