I need the ORDER ITEM ID in order to consume the service RefundInvoice at Magento 2 to create a credit memo with a refund (http://devdocs.magento.com/guides/v2.1/mrg/ce/Sales/services.html).
Order item ID is I definitely something else than the order ID, since I tried that one.
So anyone an idea how I can retrieve the order item id?
2
Answers
//Try with below code.
The item_id is actually the
entity_id
for sales_order_item. It is NULL until the record is saved to the database, upon when it is populated with the row ID. In order to access it and find its value, the salesOrderItem object must call ->save() first. If you are looking for the actual “item id” (the product), use product_id. If you need to record the record ID, then call$object->save()
, and then you can read$object->getItemId()