Skip to main content

Observer

How to redirect a customer to another URL from Observer

In order to redirect a customer from observer you need to use another way than the Controller 

 

protected $_response;
protected $_objectManager;
public function __construct(
    \Magento\Framework\App\ResponseInterface $response,
    \Magento\Framework\ObjectManagerInterface $objectManager,
    ) {
        $this->_response = $response;
       $this->_objectManager = $objectManager;
   }

 

then in your function you can use this