Error with cart update after removal of first item in product group
SolidGeek opened this issue · comments
First of all, thanks for the class, it works great. However, I found a small bug while using product variants. If you add two or more variants of the same product to the cart, and removes the one with index 0, the indexing goes bad. This is because, the array doesn't get re-indexed after item removal, and each cart operation starts at index 0. I found that re-indexing the variant arrays after the removal of a variant fixes this.
public function remove($id, $attributes = []){
...
unset($this->items[$id][$index]);
$this->items[$id] = array_values($this->items[$id]);
...
}