After creating shipment I'm saving additional data to it and need to display this data in shipment grid.

I've added column named 'some_data' in sales_shipment and sales_shipment_grid tables in database. Also added UI components to display this column in shipment_grid:


<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="some_data">
            <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">Some Data</item>

Also added configuration in MyNamespace/MyModule/etc/adminhtml/di.xml:

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<virtualType name="ShipmentGridAggregator" type="Magento\Sales\Model\ResourceModel\Grid">
        <argument name="columns" xsi:type="array">
            <item name="some_data" xsi:type="string">sales_shipment.some_data</item>

Value successfully saves to sales_shipment table but not to sales_shipment_grid table, therefore column in admin shipment grid remains empty.

How can I populate this custom column with data from sales_shipment table column?

Maybe there are other approaches? All examples I've found were for sales_order_grid and they does not work for sales_shipment_grid.

1 Answer 1


Well, it's working. The only thing needed changes was to add above di configuration to MyNamespace/MyModule/etc/di.xml (not MyNamespace/MyModule/etc/adminhtml/di.xml).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.