src/Observer/RedirectToCheckoutObserver.php
public function execute(Observer $observer)
    {
        if (!$this->scopeConfig->getValue(self::CONFIG_PATH_REDIRECT_TO_CHECKOUT, ScopeInterface::SCOPE_STORE)) {
            return;
        }

        /** @var Http $request */
        $request = $observer->getData('request');
        $request->setParam('return_url', $this->url->getUrl('checkout'));
    }
public function execute(Observer $observer)
    {
        if (!$this->scopeConfig->getValue(self::CONFIG_PATH_REDIRECT_TO_CHECKOUT, ScopeInterface::SCOPE_STORE)) {
            return;
        }

        /** @var Http $request */
        $request = $observer->getData('request');
        $request->setParam('return_url', $this->url->getUrl('checkout'));
    }
public function execute ( Observer $ observer ) { if ( ! $ this -> scopeConfig -> getValue ( self :: CONFIG_PATH_REDIRECT_TO_CHECKOUT , ScopeInterface :: SCOPE_STORE ) ) { return ; } /** @var Http $request */ $ request = $ observer -> getData ( 'request' ) ; $ request -> setParam ( 'return_url' , $ this -> url -> getUrl ( 'checkout' ) ) ; }
Redirects directly to checkout on adding product, if we're configured to do so.

@param Observer $observer
@return void
Redirects directly to checkout on adding product if we re configured to do so .