Im creating a Magento 2 checkout plugin, I want to fetch the orderdata and send it to a third party for order handling.

I have made a plugin for the Magento\Sales\Api\OrderManagementInterface class, where I want to write a new function for the place method.

this is my code:


<?xml version="1.0" ?>
    <type name="Magento\Sales\Api\OrderManagementInterface">
        <plugin name="CbFashionAfterPlacePlugin" type="\Digitaq\CbFashion\Plugin\Order\PlaceAfterPlugin" />



namespace Digitaq\CbFashion\Plugin\Order;

class PlaceAfterPlugin {

    public function afterPlace()

Even though I have not added any new functionalities, the checkout redirects to the cart with the items still in it, and I can't see an error getting logged anywhere.

Can anybody tell me what the right way is to get the order data after an order is placed, both from admin as frontend? What is going wrong in this situation?

I have also tried to do it with an Observer using the sales_order_place_after event, but this gave the same result. Any help would be highly appreciated!

1 Answer 1


Magento doesn't recommend you to use the Plugins to perform the custom operation(sending data to third-party). Plugins are used to modify input arguments to a method or the output of a method only.

Magento provides many events to observe the new order activity and you can use them scope wise according to your needs: Available Globally:

Event name: sales_order_place_after
File: vendor/magento/module-sales/Model/Order.php

Available on the Frontend only:

Event name: checkout_onepage_controller_success_action
File: vendor/magento/module-checkout/Controller/Onepage/Success.php
  • I have tried making an observer for the sales_order_place_after event, but this had the same result as what I'm having now. The observer was being called, but when I entered any new code it resulted in the checkout redirecting to the cart without any error messages. Do you know how I could debug that?
    – Digitaq
    Commented Feb 27, 2019 at 18:01

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.