/** * Get resolved back url, rewritten to return checkout URL instead of cart url * * @param \Magento\Checkout\Controller\Cart\Add $subject * @return string */ public function afterExecute(\Magento\Checkout\Controller\Cart\Add $subject, \Magento\Framework\Controller\Result\Redirect $redirect) { $shouldRedirectToCart = $this->_config->getValue('checkout/cart/redirect_to_cart', \Magento\Store\Model\ScopeInterface::SCOPE_STORE); if ($shouldRedirectToCart && !$subject->getRequest()->getParam('in_cart')) { $redirect->setUrl($this->_url->getUrl('checkout/index/index')); } return $redirect; }
/** * {@inheritdoc} */ public function dispatch(\Magento\Framework\App\RequestInterface $request) { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'dispatch'); if (!$pluginInfo) { return parent::dispatch($request); } else { return $this->___callPlugins('dispatch', func_get_args(), $pluginInfo); } }
/** * {@inheritdoc} */ public function getResponse() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getResponse'); if (!$pluginInfo) { return parent::getResponse(); } else { return $this->___callPlugins('getResponse', func_get_args(), $pluginInfo); } }