I have an instance of \Magento\Quote\Model\Quote\Item $item
I need to get the order ID of the order in which that particular item has been purchased.
For full disclosure, I am using a plugin function called afterConvert, which operates around the function "convert" in
Magento\Quote\Model\Quote\Item\ToOrderItem Anyway, the table for quote_item doesn't seem to have the order_id in it.
Any idea how I could go about it?
public function aroundConvert( \Magento\Quote\Model\Quote\Item\ToOrderItem $subject, \Closure $proceed, \Magento\Quote\Model\Quote\Item $item, $additional = [] ) { $order = null; $item->getQuote(); $options = $this->configurationHelper->getOptions($item); foreach ($options as $option){ if($option['label'] == 'Clarity'){ $clarity = $option['value']; } if($option['label'] == 'Color'){ $color = $option['value']; } if($option['label'] == 'Shape'){ $shape = $option['value']; } if($option['label'] == 'Carat'){ $carat = $option['value']; } } /** @var \Magento\ConfigurableProduct\Api\Data\ConfigurableItemOptionValueInterface $option */ $qrcode = $this->qrcodeFactory->create(); $orderID = $item->getOrderId(); But $item->getOrderId doesn't work.