”’
public function execute(Observer $observer)
{
$item = $observer->getEvent()->getData('quote_item');
$product = $item->getProduct();
if ($product->getFinalPrice() > 100 && !$this->customerSession->isLoggedIn()) {
$this->messageManager->addError('You need to login for adding any product worth 100 or more');
$item->getQuote()->removeItem($item->getId());
}
}
}
”’
work this using checkout_cart_product_add_before event