Zend certified PHP/Magento developer

Magento2 sales_order_item db table contains simple items without prices when configurable products is linked to

I’m not a Magento expert and I have to solve an highlighted issue.
Let me explain the scenario.

I noticed that, when an order contains an item with options two rows are created into the sales_order_item db table:

  • one row is related to the configurable product
  • one row related to the linked simple product

I think that this is correct but I’m not able to understand why, for the order item that it’s related to the simple product, there isn’t any information about the prices.
All the prices are zero and I can see them for on the related configurable item. I noticed this after the upgrade to Magento 2.4.4.

SIMPLE:

'112853', '96037', '112852', '513440', '3', '2023-03-06 12:45:38', '2023-03-06 12:45:38', '16132', 'simple', '{"info_buyRequest":{"uenc":"aHR0cHM6Ly9hbHBoYS5uYXZpb25pY3MuY29tL2l0YS9uYXZpb25pY3MtcGx1cy1za2FnZXJyYWstYW5kLWthdHRlZ2F0LTIuaHRtbA,,","product":"16077","selected_configurable_option":"","related_product":"","qty":"1","super_attribute":{"140":"4"}}}', '1.0000', '0', 'mySKU', 'My prod name', NULL, NULL, NULL, '0', '0', NULL, '0.0000', '1.0000', '1.0000', '0.0000', '0.0000', NULL, '0.0000', '0.0000', '0.0000', NULL, '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0.0000', '0.0000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0.0000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '11111'

CONFIGURABLE:

'112852', '96037', NULL, '513439', '3', '2023-03-06 12:45:38', '2023-03-06 12:47:18', '16077', 'configurable', '{"info_buyRequest":{"uenc":"aHR0cHM6Ly9hbHBoYS5uYXZpb25pY3MuY29tL2l0YS9uYXZpb25pY3MtcGx1cy1za2FnZXJyYWstYW5kLWthdHRlZ2F0LTIuaHRtbA,,","product":"16077","selected_configurable_option":"","related_product":"","qty":"1.0000","super_attribute":{"140":"4"}},"attributes_info":[{"label":"my option label","value":"my option value","option_id":140,"option_value":"4"}],"simple_name":"My prod name","simple_sku":"mySKU","product_calculations":1,"shipment_type":0}', '1.0000', '0', 'mySKU', 'My prod name', NULL, NULL, NULL, '0', '0', NULL, '0.0000', '1.0000', '1.0000', '0.0000', '1.0000', NULL, '204.9100', '204.9100', '204.9100', '204.9100', '22.0000', '45.0800', '45.0800', '45.0800', '45.0800', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '0.0000', '204.9100', '204.9100', '204.9100', '204.9100', '1.0000', NULL, NULL, NULL, NULL, NULL, '249.9900', '249.9900', '249.9900', '249.9900', '0.0000', '0.0000', '0.0000', '0.0000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, '0', '[]', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0.0000', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '11111'

I’m asking because I’m trying to create a credit memo + automatically refund programmatically and I’m not able to retrieve the prices to be refunded.