How to Convert Custom Field From Quote Item to Order Item in Magento 2
Hello Magento peeps! 💻
I am back with another technical solution to help you convert custom field from quote item to order item in Magento 2.
The quote item table in Magento 2 represents the shopping cart and stores all the information about the product, quantity, prices, etc. On the successful placement of the order, all the fields from the quote item are converted to the order item table by default in Magento 2.
However, the custom fields in the quote item are not passed to the order object. This blog post is the solution to convert a custom field in Magento 2 quote item to order item. This is helpful when you have created custom columns in the quote item table and want to convert them into order items in Magento 2.
Let’s see how you can convert custom fields in the quote to order programmatically in Magento 2.
Steps to Programmatically Convert Custom Field From Quote Item to Order Item in Magento 2
In case you have a custom field in the quote item table and want to pass that to the order item table in Magento 2, you can follow the simple and easy steps mentioned below.
Step 1: Create a di.xml file at the app/code/Vendor/Extension/etc/ directory and add the following code:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<plugin name="quote_to_order_item_conv" type="Vendor\Extension\Plugin\Quote\ConvertToOrderItem"/>
Step 2: Create ConvertToOrderItem.php file at the app/code/Vendor/Extension/Plugin/Quote directory with the following code:
public function aroundConvert(
$additional = 
$orderItem = $proceed($item, $additional);
This is how easily you can pass the custom field from the quote item to the order item table in Magento 2. 😃
Have any doubts? Feel free to comment. I will be happy to help you. 😇
Also, do not forget to share this solution with your developer friends via social media.
Thanks for reading. 🍀