customerSession = $customerSession; parent::__construct($context); } /** * Check customer authentication for some actions * * @param \Magento\Framework\App\RequestInterface $request * @return \Magento\Framework\App\ResponseInterface */ public function dispatch(RequestInterface $request) { if (!$this->customerSession->authenticate()) { $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); } return parent::dispatch($request); } }