diff --git a/Service/Quote/QuoteHasMealVoucherProducts.php b/Service/Quote/QuoteHasMealVoucherProducts.php index 94d0cf49ed2..b5f429e661d 100644 --- a/Service/Quote/QuoteHasMealVoucherProducts.php +++ b/Service/Quote/QuoteHasMealVoucherProducts.php @@ -26,13 +26,17 @@ public function __construct( public function check(CartInterface $cart): bool { - $itemsWithCategories = array_filter($cart->getItems() ?? [], function (CartItemInterface $cartItem) { + if ($cart->getItems() === null) { + return false; + } + + $itemsWithCategories = array_filter($cart->getItems(), function (CartItemInterface $cartItem) { $category = $this->getProductCategory($cartItem->getProduct()); return $category && $category != 'none'; }); - return count($itemsWithCategories); + return count($itemsWithCategories) == count($cart->getItems()); } private function getProductCategory(ProductInterface $product)