0

After successful purchase in the order details page when i click reorder option it throw below exception

TypeError: Magento\Framework\DataObject::__construct(): Argument #1 ($data) must be of type array, null given, called in /var/www/html/magento2/vendor/magento/module-sales/Model/Reorder/OrderInfoBuyRequestGetter.php on line 65 and defined in /var/www/html/magento2/vendor/magento/framework/DataObject.php:40

2
  • If you are using third party extension related to order, try to disable that and then check. Commented Mar 21 at 11:24
  • I add a product to the cart programmatically using events. If I do not add a product programmatically, that means the reorder action will not throw an exception.
    – ARUL.K
    Commented Mar 22 at 13:02

1 Answer 1

0

In my scenario, I add a product to the cart programmatically. In the code, I did not add the necessary data for ordering products. So in the Database the sale_order_item table product_option column has an empty array of data. When I add the data in the quote item for ordering products, then the data correctly saved in the sale_order_item table product_option column, it won't throw an exception for me!.

    $url = 'Your url';
    $uenc = base64_encode($url);
    $productOptions = [
          'info_buyRequest' => [
              'uenc' => $uenc,
              'product' => $productId,
              'qty' => 1
          ]
    ];
    $quoteItem->addOption([
         'product_id' => $productId,
         'code' => 'info_buyRequest',
         'value' => json_encode($productOptions)
    ]);
    $quote->save();    

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.