Skip to content

Commit

Permalink
fix removing non-existing item bug
Browse files Browse the repository at this point in the history
  • Loading branch information
avrahamappel committed Jan 16, 2020
1 parent 04918d8 commit 4c38021
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Concerns/ManagesCartItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public function remove(int $item): self
return $i->getKey() == $item;
});

if ($key === false) {
return $this;
}

$this->items()->pull($key)->delete();

if ($this->items()->isEmpty()) {
Expand Down

0 comments on commit 4c38021

Please sign in to comment.