I have working on data migration from non-magento e-com website to magento 2.x EE. I have question about that I can't save the data after call save();

$customerOrder = $this->_objectManager->create('\Magento\Sales\Model\Order');

//total = shipping fee + items total
$customerOrder->setData('base_subtotal',$val->_orginal_price); //item totals
$customerOrder->setData('store_id',1);//store ID


Fatal error: Call to a member function getMethodInstance() on null in D:\xampp\htdocs\hktshop_uat\vendor\magento\module-payment\Observer\SalesOrderBeforeSaveObserver.php on line 24

Anyone have experience on migration?

1 Answer 1


We need to set payment method for our order, for example:

    $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); 
    //$orderPayment = $objectManager->create('Magento\Sales\Api\Data\OrderPaymentInterface');
    $orderPayment = $objectManager->create('Magento\Sales\Model\Order\Payment');

        ->setPoNumber(' - ');
  • Thanks you very much, I can save the data into sales_order & sales_order_payment table by your suggestion. But I can't open the order detail on admin page. which tables or data I miss to insert ? The error : > Order View Information Changes have been made to this section that have not been saved. This tab contains invalid data. Please resolve this before saving.
    – user35225
    Aug 16, 2016 at 4:07

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.