In default Magento2, on canceling paypal express checkout (closing the paypal popup), redirects to the Shopping Cart. Is there an easy way to stop redirecting to shopping cart and display the success/error messages on checkout page itself? Any help/suggestion is appreciated!

Thank you!

1 Answer 1


In case, of PayPal express checkout, the redirect can be changed in below file


Change the line

return $resultRedirect->setPath('checkout/cart');


return $resultRedirect->setPath('checkout');

Obviously, please don't modify the file directly and instead rewrite it using Magento 2's preferences :)

For other PayPal methods, it can be found under related controller file under the directory


  • But this is not helping me to resolve my problem. The problem is, in case of guest customer if the checkout page is refreshed then the previously entered shipping address will not be fetched by Magento and guest has to re-enter shipping address. Here 2 approaches I can think of 1) On PayPal cancel, do not refresh page and show message on checkout itself. 2) Save shipping address details for guest checkout and fetch it on refresh of checkout page. Jul 10, 2018 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.