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:
etc/di.xml
<?xml version="1.0" ?>
<config>
<type name="Magento\Sales\Api\OrderManagementInterface">
<plugin name="CbFashionAfterPlacePlugin" type="\Digitaq\CbFashion\Plugin\Order\PlaceAfterPlugin" />
</type>
</config>
Digitaq\CbFashion\Plugin\Order\PlaceAfterPlugin
<?php
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!