somascope
12/24/2018 - 8:37 PM

Splice item from array

Remove one item from an array of items

dec (item) {
  item.qty--;
  this.total -= item.price;
  if (item.qty <= 0) {
    var i = this.cart.indexOf(item); // Get current position of item
    this.cart.splice(i,1) // Use .splice(i,1) to remove the current item
  }
}