Magento how to stop /checkout/onepage/success/ redirecting
You can stop checkout success page redirection after refresh page, for styling and testing purposes, with this below code:
Go to this file:
vendor/magento/module-checkout/Controller/Onepage/Success.php
and comment Out Line No : 22
//$session->clearQuote();
Now you will be able to refresh and debug success page without redirecting.
Don't forget to uncomment after working.
You can change the /app/code/core/Mage/Checkout/controllers/OnepageController.php
file. Modify the successAction, so it looks like this:
public function successAction()
{
/*
$session = $this->getOnepage()->getCheckout();
if (!$session->getLastSuccessQuoteId()) {
$this->_redirect('checkout/cart');
return;
}
$lastQuoteId = $session->getLastQuoteId();
$lastOrderId = $session->getLastOrderId();
$lastRecurringProfiles = $session->getLastRecurringProfileIds();
if (!$lastQuoteId || (!$lastOrderId && empty($lastRecurringProfiles))) {
$this->_redirect('checkout/cart');
return;
}
$session->clear();
*/
$this->loadLayout();
$this->_initLayoutMessages('checkout/session');
Mage::dispatchEvent('checkout_onepage_controller_success_action', array('order_ids' => array($lastOrderId)));
$this->renderLayout();
}
Remember to remove the comments when you're done!