show an error message in adding item to the cart if the user is not logged and the item have price greater than 100 that item shouldnot added to cart
”’ 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… Read More »show an error message in adding item to the cart if the user is not logged and the item have price greater than 100 that item shouldnot added to cart