showProductOrNot = $showProductOrNot; } public function execute(Observer $observer) { if (!$this->showProductOrNot->checkByNetsuiteStatus()) { throw new \Magento\Framework\Exception\LocalizedException(__('You cannot purchase right now.')); } } }