1

I want to save order data in custom Table After order success. app/code/VendorName/Checkout/etc/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="MyObserver" instance="VendorName\Checkout\Observer\MyObserver"  />
    </event> 
</config>

app/code/VendorName/Checkout/Observer/MyObserver.php

<?php
namespace VendorName\Checkout\Observer;

use Magento\Framework\Event\ObserverInterface;

class MyObserver implements ObserverInterface
{
      public function execute(\Magento\Framework\Event\Observer $observer)
    {

     $orderIds = $observer->getEvent()->getOrderIds();
     echo $orderId = $orderIds[0]; exit;

    }

}

Event is not trigger success.phtml is redirected.

Bruntha Nivas
  • 13
  • 1
  • 3

1 Answers1

1

The event.xml file name should be events.xml. After renaming file check again

If still the problem, put your events file to

app/code/VendorName/Checkout/etc/frontend/events.xml

Confirm if the plugin installed by executing

php bin/magento module:status

If the module is not listed, execute

php bin/magento setup:upgrade
Rakesh Jakhar
  • 6,380
  • 2
  • 11
  • 20