0

Place order is working good but after place order page redirect to cart page.

I have put log in success.phtml file and found that success.phtml file is called.

But I don't know why it's redirect to empty cart page. This issue is occurring some random time.

So i want to know the list of modules called at success page, maybe some custom module creating issue with session.

Can anyone help me to get list of modules called at success page?

File: vendor\magento\module-checkout\Controller\Onepage\Success.php

There is some issue with session : if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid())

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Checkout\Controller\Onepage;

use Magento\Framework\App\Action\HttpGetActionInterface as HttpGetActionInterface;

/**
 * Onepage checkout success controller class
 */
class Success extends \Magento\Checkout\Controller\Onepage implements HttpGetActionInterface
{
    /**
     * Order success action
     *
     * @return \Magento\Framework\Controller\ResultInterface
     */
    public function execute()
    {
        $session = $this->getOnepage()->getCheckout();
            $writer = new \Zend\Log\Writer\Stream(BP . '/var/log/cart_redirect.log');
            $logger = new \Zend\Log\Logger();
            $logger->addWriter($writer);
            $logger->info("Reached Controller/Onepage/Success.php to redirect on cart. Last placed OrderId: ".$session->getLastOrderId());

        if (!$this->_objectManager->get(\Magento\Checkout\Model\Session\SuccessValidator::class)->isValid()) {
            $logger->info("Before Redirect from Controller/Onepage/Success.php to redirect on cart. Last placed OrderId: ".$session->getLastOrderId());
            return $this->resultRedirectFactory->create()->setPath('checkout/cart');
        }
        $session->clearQuote();
        //@todo: Refactor it to match CQRS
        $resultPage = $this->resultPageFactory->create();
        $this->_eventManager->dispatch(
            'checkout_onepage_controller_success_action',
            [
                'order_ids' => [$session->getLastOrderId()],
                'order' => $session->getLastRealOrder()
            ]
        );
        return $resultPage;
    }
}

Thanks.

  • Have you check the log file? and in which payment method order you face this issues? – Dhiren Vasoya Aug 19 at 6:59
  • Not getting any help from log, paypal express and authorized.net – Jimit Bhavsar Aug 19 at 9:40
  • @JimitBhavsar Did u find any solution for this issue? I am facing same issue even with Check money order payment method as well. Magento version is: Enterprise 2.3.5-p2 – MagentoDev Aug 25 at 12:15
  • It' redis cache issue and we have remove it – Jimit Bhavsar Aug 26 at 12:08

Your Answer

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

Browse other questions tagged or ask your own question.