this.addItem = function (id, name, price, quantity, data) {
var inCart = this.getItemById(id);
if (typeof inCart === 'object'){
//Update quantity of an item if it's already in the cart
inCart.setQuantity(quantity, false); // <- shoudn't this be TRUE instead?!
} else {
var newItem = new ngCartItem(id, name, price, quantity, data);
this.$cart.items.push(newItem);
$rootScope.$broadcast('ngCart:itemAdded', newItem);
}
$rootScope.$broadcast('ngCart:change', {});
};
I strongly believe that quantity never get updated when calling ngCart.addItem() twice for the same item.
Since https://github.com/snapjay/ngCart/blob/1.0.0/src/ngCart.js#L47 passes
relative = false
ininCart.setQuantity()
I strongly believe that quantity never get updated when calling ngCart.addItem() twice for the same item.