Basically I want to display custom module page after "Checkout Page" and Before "Order Success Page".

I created the module manually and want to add a page between checkout page and order success page. On that page I have to collect some data from the users (data about the products that he/she selected), after place order button.

After collecting the data from the users, I have to redirect to the Order Success Page.

Any Solution would be much appreciated!


  • 1
    You want this after place Order or before place order? Aug 18, 2020 at 7:05
  • Hello @DhirenVasoya After place order and before order success page Aug 18, 2020 at 7:10

1 Answer 1


Open your_company/your_module/etc/frontend/ create a file here event.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="checkout_onepage_controller_success_action">
        <observer name="companyname_order_success" instance="CompanyName\ModuleName\Observer\Orderplaceafter" />

Then create an Observer folder in your module and place a file Orderplaceafter.php


namespace CompanyName\ModuleName\Observer;

use Magento\Framework\Event\ObserverInterface;
use Psr\Log\LoggerInterface;

class Orderplaceafter implements ObserverInterface
    protected $_responseFactory;
    protected $_url;

    public function __construct(
        \Magento\Framework\App\ResponseFactory $responseFactory,
        \Magento\Framework\UrlInterface $url
    ) {
        $this->_responseFactory = $responseFactory;
        $this->_url = $url;
    public function execute(\Magento\Framework\Event\Observer $observer)
        $event = $observer->getEvent();
        $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
        $_checkoutSession = $objectManager->create('\Magento\Checkout\Model\Session');
        $_quoteFactory = $objectManager->create('\Magento\Quote\Model\QuoteFactory');
        $order = $_checkoutSession->getLastRealOrder();
        $quote = $_quoteFactory->create()->loadByIdWithoutStore($order->getQuoteId());
        if ($quote->getId()) {
            $url = $this->_url->getUrl('prescription/index');

Then run commands:

php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento setup:static-content:deploy -f php bin/magento cache:flush

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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