Zend certified PHP/Magento developer

Magento order with only one simple item with parent-id and without any price

I have a strange issue.

Sorry for the long description but I would like to provide to you as much as possible the information that I collected.

I’m not a Magento expert so, I don’t know if this is correct behaviour or if it’s possible to understand/fix it.

Let me explain what I notiest..

On our side, we upgraded our environments to Magento 2.4 version.

After this long migration, we are able to complete the order successfully.

Also on the admin side, we are able to see the order details correctly.

Everythings seems to work fine…

On the processing order flow, we have some observer in order to notify the order to external systems like billing, shipments etc.

In this flow, when the order is shipped and the user requires the return, we are using the module Amasty RMA to manage the return flow.

Also here, using some observer, we have to notify the event to external systems. This seems to work fine also but, only for some products, I noticed a strange behaviour that breaks the flow:

In my observer, when I receive the RMA return notification event, I retrive the rma-entity and the order details.

From the RMA entity I retrieve the involved order-items. Please note that the RMA Entity contains the involved order-id so, using the order entity I can obtain the order-item info.

The strange thing is that, in the order items (as also into the involved RMA items) I’m able to find only the item that it’s a ‘simple’ item, with a parent_id not null and without any prices.

In my opinion it’s correct that the type of the item is ‘simple’ but, in my opinion this should not have the parent_id and should have the item prices.

When this happens, the flow works fine. When the item has these properties that I described above, the flow gets in error.

I checked the order-items on the db table also.

I’m not able to understand if this is a wrong product configuration or something like this. I’m not able to understand what I have to compare between the products where one works fine and the other does not.

Please note that I reported the most important aspects of my analysis but, in my opinion, the RMA flow or the Amasty RMA module that we are using it’s not the cause of this problem. I would like to say this because, without any RMA request, just checking the DB table I’m able to see the order item that it’s affected by the same ‘issue’ (only one item with the parent-id not null and without any price).

Why only for some products, into the order-items table, the involved item has the parent-id? When this row is created and why aren’t the prices?