Magento 2 how add extension attribute to order item
create order use postman Place order: [POST] /rest/V1/carts/mine/payment-information
set order item extension attribute in magento 2
"extension_attributes": {
"shipping_assignments": [
{
"shipping": {
"total": {
"base_shipping_amount": 0,
"base_shipping_discount_amount": 0,
"base_shipping_discount_tax_compensation_amnt": 0,
"base_shipping_incl_tax": 0,
"base_shipping_tax_amount": 0,
"shipping_amount": 0,
"shipping_discount_amount": 0,
"shipping_discount_tax_compensation_amount": 0,
"shipping_incl_tax": 0,
"shipping_tax_amount": 0
}
},
"items": [
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_original_price": 1.3014,
"base_price": 1.3014,
"base_price_incl_tax": 1.301428,
"base_row_invoiced": 0,
"base_row_total": 1.301428,
"base_row_total_incl_tax": 1.301428,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-09-15 12:00:07",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"is_qty_decimal": 1,
"is_virtual": 1,
"item_id": 1001,
"name": "test 1",
"no_discount": 0,
"order_id": 2401,
"original_price": 1.3014,
"price": 1.3014,
"price_incl_tax": 1.301428,
"product_id": 1,
"product_type": "virtual",
"qty_canceled": 0,
"qty_invoiced": 0,
"qty_ordered": 1,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 3699,
"row_invoiced": 0,
"row_total": 1.301428,
"row_total_incl_tax": 1.301428,
"row_weight": 0,
"sku": "test1",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-09-15 12:00:07",
"extension_attributes": {
"ord_amt": "200",
"ord_data": "test",
}
},
{
"amount_refunded": 0,
"base_amount_refunded": 0,
"base_discount_amount": 0,
"base_discount_invoiced": 0,
"base_discount_tax_compensation_amount": 0,
"base_original_price": 4374.0861,
"base_price": 4374.0861,
"base_price_incl_tax": 4374.086099,
"base_row_invoiced": 0,
"base_row_total": 4374.086099,
"base_row_total_incl_tax": 4374.086099,
"base_tax_amount": 0,
"base_tax_invoiced": 0,
"created_at": "2022-09-15 12:00:07",
"discount_amount": 0,
"discount_invoiced": 0,
"discount_percent": 0,
"free_shipping": 0,
"discount_tax_compensation_amount": 0,
"is_qty_decimal": 1,
"is_virtual": 1,
"item_id": 1002,
"name": "test 2",
"no_discount": 0,
"order_id": 2401,
"original_price": 4374.0861,
"price": 4374.0861,
"price_incl_tax": 4374.086099,
"product_id": 5,
"product_type": "virtual",
"qty_canceled": 0,
"qty_invoiced": 0,
"qty_ordered": 1,
"qty_refunded": 0,
"qty_shipped": 0,
"quote_item_id": 3700,
"row_invoiced": 0,
"row_total": 4374.086099,
"row_total_incl_tax": 4374.086099,
"row_weight": 0,
"sku": "test2",
"store_id": 1,
"tax_amount": 0,
"tax_invoiced": 0,
"tax_percent": 0,
"updated_at": "2022-09-15 12:00:07",
"extension_attributes": {
"ord_amt": "100",
"ord_data": "test",
}
}
]
}
],