-
Magento2 redirection from Observer
Magento2 redirection from Observer Magento2 redirection from Observer needs serval times.In Some events, you need to forcefully redirect to some pages basic your business logic. At magento 1.x,we can do using Mage::app()->getResponse()->setRedirect(‘YourRedirectUrl’)->sendResponse(); Something is required forMagent0 2.X version.This version uses modern technologies Namespace, interface, Factory class etc.So there not easy to do a redirection from an Observer. Most case, developer need to implement forceful redirection to Observer as per their client requirement =========================================== I have found a solution by myself by doing a research If you want to do that then you should below inject two classes. First, \Magento\Framework\App\ResponseFactory which responsible for redirection, Another class which\Magento\Framework\UrlInterface will make…