I have a custom value (In a Magento 2.3.3 installation )that gets added to the quote_item table when I add an item to the basket. When I go to checkout I want to pass that value to the same-named column in the sales_order_item table. I am using the event sales_model_service_quote_submit_before to copy my quote data to the sales order table but for some reason, the data to be inserted into the sales_order_item table won't store. Below is the code I am using.
foreach($order->getItems() as $item) { $quoteItem = $quote->getItemById($item->getQuoteItemId()); if ($quoteItem) { if($quoteItem->hasData('deposit')){ $item->setData('deposit', $quoteItem->getDeposit()); } } } If I debug straight after the contents of $item then I get the value but it is not storing in the table.