Doing url redirects is an easy thing rewriting a controller class, as $this->resultRedirectFactory
is accessible as it is one of default injected objects
But, can we use this in plugins? I've been trying different ways, with no success
For instance... let's say I want to write plugin for \Magento\Multishipping\Controller\Checkout\Addresses controller execute()
method, ignoring all logic & just redirecting to checkout/cart
Can someone provide how we could do this in a plugin with the 3 possible approaches (before
, around
& after
)? Full code of the plugin class would be great, as my main problem is I haven't understand yet about how plugin parameters work
UPDATE
Not 100% sure, but I believe I tried same code as kirby solution yesterday, but using before
plugin and saw constructor errors in frontend...