From 7563d534e5bc4447c1aeea783a78d0f8d53ba701 Mon Sep 17 00:00:00 2001 From: Thomas Klein Date: Mon, 6 Jun 2022 12:21:24 +0200 Subject: [PATCH] shortend isSaleable observer --- Observer/Product/IsSaleable.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Observer/Product/IsSaleable.php b/Observer/Product/IsSaleable.php index 16b23c1..f7d2fba 100644 --- a/Observer/Product/IsSaleable.php +++ b/Observer/Product/IsSaleable.php @@ -34,12 +34,12 @@ public function execute(Observer $observer): void $saleable = $observer->getData('salable'); if ($product instanceof DataObject && $saleable instanceof DataObject) { - $groupId = $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP); - $isSalable = $saleable->getData('is_salable') && $product->getData('can_show_price') && $product->getData('is_purchasable'); - $isSalable = $isSalable && $groupId !== null ? $this->isSaleable->isSaleable((int) $groupId) : $isSalable; + $isSalable = $isSalable + ? $this->isSaleable->isSaleable((int) $this->httpContext->getValue(CustomerContext::CONTEXT_GROUP)) + : false; $saleable->setData('is_salable', $isSalable); }