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.

    Before following the below steps, you can create the order attribute and store it into the value.

    Step 1: Create module.xml file under app/code/Vendor/Modulename/etc directory and registration.php file under app/code/Vendor/Modulename directory.

    Step 2: Create sales_order_shipment_grid.xml file under app/code/Vendor/Modulename/view/adminhtml/ui_component directory with below code

    <?xml version="1.0" encoding="UTF-8"?>
    <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
        <columns name="sales_order_shipment_columns">
            <column name="custcolumn" class="VendorModulenameUiComponentListingColumnCustcolumn">
                <argument name="data" xsi:type="array">
                    <item name="config" xsi:type="array">
                        <item name="filter" xsi:type="string">text</item>
                        <item name="label" xsi:type="string" translate="true">Custom Column</item>
                    </item>
                </argument>
            </column>
        </columns>
    </listing>
    

    Step 3: Create Custcolumn.php ui component class file under app/code/Vendor/Modulename/Ui/Component/Listing/Column directory with below code

    <?php
    namespace VendorModulenameUiComponentListingColumn;
     
    use MagentoSalesApiOrderRepositoryInterface;
    use MagentoFrameworkViewElementUiComponentContextInterface;
    use MagentoFrameworkViewElementUiComponentFactory;
    use MagentoUiComponentListingColumnsColumn;
    use MagentoFrameworkApiSearchCriteriaBuilder;
     
    class Custcolumn extends Column
    {
     
        protected $_orderRepository;
        protected $_searchCriteria;
        protected $_customfactory;
     
        public function __construct(
            ContextInterface $context,
            UiComponentFactory $uiComponentFactory,
            OrderRepositoryInterface $orderRepository,
            SearchCriteriaBuilder $criteria,
            MagentoFrameworkAppResourceConnection $resource,
            MagentoSalesModelOrderFactory $orderFactory,
            array $components = [], array $data = [])
        {
            $this->_orderRepository = $orderRepository;
            $this->_searchCriteria  = $criteria;
            $this->resource = $resource;
            $this->orderFactory = $orderFactory;
            parent::__construct($context, $uiComponentFactory, $components, $data);
        }
     
        public function prepareDataSource(array $dataSource)
        {
            if (isset($dataSource['data']['items'])) {
                $connection  = $this->resource->getConnection();
                $tableName = $connection->getTableName('sales_shipment_grid'); 
                foreach ($dataSource['data']['items'] as & $item) {
                    $order = $this->orderFactory->create()->loadByIncrementId($item["order_increment_id"]);
                    if($order->getCustcolumn()){
                        $item['custcolumn'] = $order->getCustcolumn();
                    }
                }
            }
            return $dataSource;
        }
    }

     

    field_5bfb909c5ccae

      Get a Free Quote