in Magento 2 i extend the magento place order function \Magento\Sales\Model\Order but i did give the order id

public function afterPlace(\Magento\Sales\Model\Order $subject, $result){
    return $result;


public function place(\Magento\Sales\Api\Data\OrderInterface $order)
    // transaction will be here
    //begin transaction
    try {
        return $this->orderRepository->save($order);
    } catch (\Exception $e) {
        throw $e;

It seems order place() is done before it's saved, so it explains why you can't get ID

You'd better change your after plugin to Magento\Sales\Model\Service\OrderService place() method, in the case you are using standard checkout


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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