From 3a5a38f441fe80ca5e9274b1ba79194877e90a9d Mon Sep 17 00:00:00 2001 From: SzymonKostrubiec Date: Tue, 2 Jul 2024 07:46:30 +0200 Subject: [PATCH] OP-282 - fix tests, update command handler --- .../Wishlist/AddSelectedProductsToCartHandler.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/CommandHandler/Wishlist/AddSelectedProductsToCartHandler.php b/src/CommandHandler/Wishlist/AddSelectedProductsToCartHandler.php index 5e163a4e..182b49c7 100644 --- a/src/CommandHandler/Wishlist/AddSelectedProductsToCartHandler.php +++ b/src/CommandHandler/Wishlist/AddSelectedProductsToCartHandler.php @@ -79,13 +79,11 @@ private function productIsStockSufficient(OrderItemInterface $product): bool return false; } - if (null !== $this->availabilityChecker && - $this->availabilityChecker->isStockSufficient($variant, $product->getQuantity()) - ) { - return true; - } - - if ($variant->isInStock()) { + if (null !== $this->availabilityChecker) { + if ($this->availabilityChecker->isStockSufficient($variant, $product->getQuantity())) { + return true; + } + } elseif ($variant->isInStock()) { return true; }