From 7041a1b62cbd442a2503bc268fdc16a7fcd7e945 Mon Sep 17 00:00:00 2001 From: Tobias Wolf Date: Thu, 9 Apr 2020 16:53:23 +0200 Subject: [PATCH] Fix: productList::__set() Make sure $key is same as $cartItem['key'] --- src/productList.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/productList.php b/src/productList.php index f925b4c..f081aff 100644 --- a/src/productList.php +++ b/src/productList.php @@ -117,6 +117,11 @@ public function __set(string $key, $value): self if ($value['quantity'] < 0) { throw new \Exception('The quantity of the cart must not be negative.'); } + + if ($key !== $value['id']) { + $key = $value['id']; + } + $this->data[strtolower($key)] = $value; if ($this->getTax() < 0) {