I have created a custom field 'item_serial_number' in shipment item table(sales_shipment_item). db_schema.xml =>
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="sales_shipment_item" resource="sales" engine="innodb" comment="Sales Flat Shipment Item">
<column xsi:type="text" name="item_serial_number" nullable="true" comment="Item Serial Number"/>
</table>
</schema>
I have also added it in extension_attributes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<extension_attributes for="Magento\Sales\Api\Data\ShipmentItemCreationInterface">
<attribute code="item_serial_number" type="string"/>
</extension_attributes>
</config>
I am saving this field while creating shipment from API(rest/V1/order/order_id/ship). API Body =>
{
"items": [
{
"order_item_id": 236,
"qty": 1,
"extension_attributes": {
"item_serial_number": "sfsdfgdgw33ds"
}
}
],
"tracks": [
{
"track_number": "UB601-21B012064",
"title": "shyftgo",
"carrier_code": "shyftgo"
}
]
}
But somehow this extension attribute is not saving in table(sales_shipment_item). No error is showing, shipment is creating successfully.
I am using Magento 2.3.5 -p1.
Please let me know, what should I do? Or any other alternate solution to achieve it.