I'm trying to get parent_item_id but it is returning null for all simple child products.
$order = $observer->getEvent()->getOrder(); $items = $order->getAllVisibleItems(); foreach ($items as $item) { $itemsData[] = [ 'name' => $item->getName(), 'sku' => $item->getSku(), 'quote_item_id' => $item->getQuoteItemId(), 'parent_item_id' =>$item->getParentItemId(), 'qty_ordered' => $item->getQtyOrdered(), 'product_type' => $item->getProductType(), 'weight' => $item->getWeight(), 'price' => $item->getPrice() ]; } I'm getting all item attributes in my $itemsData array except parent_item_id, though I've 4 children of a Bundle product and 1 child of a configurable product in Cart.
I'm doing it in sales_order_place_before observer. I tried getAllItems() and getItems() as well but no luck. Also confirmed from database, parent_item_id exists there for quote_item_id, but just not able to retrieve via getter method.


