Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
order_item_list.php
Go to the documentation of this file.
1 <?php
7 require 'order.php';
11 
13  [
14  'product_id' => 1,
15  'order_id' => $order->getId(),
16  'base_price' => 90,
17  'price' => 90,
18  'row_total' => 92,
19  'product_type' => 'configurable'
20  ],
21  [
22  'product_id' => 1,
23  'base_price' => 100,
24  'order_id' => $order->getId(),
25  'price' => 100,
26  'row_total' => 102,
27  'product_type' => 'configurable'
28  ],
29  [
30  'product_id' => 12,
31  'base_price' => 110,
32  'order_id' => $order->getId(),
33  'price' => 110,
34  'row_total' => 112,
35  'product_type' => 'virtual'
36  ],
37  [
38  'product_id' => 13,
39  'base_price' => 123,
40  'order_id' => $order->getId(),
41  'price' => 123,
42  'row_total' => 126,
43  'product_type' => 'simple'
44  ]
45 ];
46 
48 foreach ($orderItems as $orderItemData) {
51  \Magento\Sales\Model\Order\Item::class
52  );
54  ->setData($orderItemData)
55  ->save();
56 }
$orderItem
Definition: order.php:30
$order
Definition: order.php:55
$objectManager
$orderItems