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
1 2 3 |
<type name="Magento\Quote\Model\Quote\Item\ToOrderItem"> <plugin name="custom_field_to_order_item" type="Vendor\ModuleName\Plugin\Quote\CustomFieldToOrderItem"/> </type> |
2. Create an CustomFieldToOrderItem.php in : app/code/Vendor/ModuleName/Plugin/Quote
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<?php namespace Vendor\ModuleName\Plugin\Quote; class CustomFieldToOrderItem { public function aroundConvert( \Magento\Quote\Model\Quote\Item\ToOrderItem $subject, \Closure $proceed, \Magento\Quote\Model\Quote\Item\AbstractItem $item, $additional = [] ) { /** @var $orderItem Item */ $orderItem = $proceed($item, $additional); $orderItem->setCustomField($item->getCustomField()); return $orderItem; } } |
[crayon-63d3e75a2dd58291997052/] Using above fucntion Images can be imported directly from...
Override view block using di.xml and add the below code...
You can check a list of called layout XML for...
Follow the below steps to install and set up PWA...
If you want to remove all leading zero's from order,...
Let our Magento expert connect to discuss your requirement.
We offer Magento
certified developers.
Our Magento clientele
is 500+.
We sign NDA for the
security of your projects.
We’ve performed 100+
Magento migration projects.
Free quotation
on your project.
Three months warranty on
code developed by us.