/** * Perform customer authentication and wishlist feature state checks * * @param \Magento\Framework\App\ActionInterface $subject * @param RequestInterface $request * @return void * @throws \Magento\Framework\Exception\NotFoundException */ public function beforeDispatch(\Magento\Framework\App\ActionInterface $subject, RequestInterface $request) { if ($this->authenticationState->isEnabled() && !$this->customerSession->authenticate($subject)) { $subject->getActionFlag()->set('', 'no-dispatch', true); if (!$this->customerSession->getBeforeWishlistUrl()) { $this->customerSession->setBeforeWishlistUrl($this->redirector->getRefererUrl()); } $this->customerSession->setBeforeWishlistRequest($request->getParams()); } if (!$this->config->isSetFlag('wishlist/general/active')) { throw new NotFoundException(__('Page not found.')); } }