We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    Follow below steps to copy data from quote item to order item in Magento 2 through the below plugin

    1. Create an di.xml in : /app/code/Vendor/ModuleName/etc

    <type name="MagentoQuoteModelQuoteItemToOrderItem">
        <plugin name="custom_field_to_order_item" type="VendorModuleNamePluginQuoteCustomFieldToOrderItem"/>
    </type>

    2. Create an CustomFieldToOrderItem.php in : app/code/Vendor/ModuleName/Plugin/Quote

    <?php
    
    namespace VendorModuleNamePluginQuote;
    
    class CustomFieldToOrderItem
    
    {
    	public function aroundConvert(
            MagentoQuoteModelQuoteItemToOrderItem $subject,
            Closure $proceed,
            MagentoQuoteModelQuoteItemAbstractItem $item,
            $additional = []
        ) {
            /** @var $orderItem Item */
            $orderItem = $proceed($item, $additional);
            $orderItem->setCustomField($item->getCustomField());
            return $orderItem;
          }
    
    }

     

     

    field_5bfb909c5ccae

      Get a Free Quote