0

Custom php script should be executed after placing the order or after performing the place order action in one page checkout page. What is the best way to do this operation or action. Should i create Custom Observer or controller?

2

1 Answer 1

0

You can use event.

Use the event checkout_submit_all_after

this event provide u current place order and it quote object

$this->_eventManager->dispatch(
    'checkout_submit_all_after',
    [
        'order' => $order,
        'quote' => $this->getQuote()
    ]
);

As you want to strick the your observer at frontend

So,define the event on

app/code/{vendorname}/{Modulename}/etc/frontent/events.xml

code

<?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_submit_all_after">
        <observer name="checkout_submit_all_after_add_andfetch" instance="{vendorname}\{Modulename}\Observer\CheckoutSubmit" />
    </event>
</config>
0

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.