I am getting the order information after the checkout process is finished and I saw something that is strange for me.
I use :
$orderItems = $order->getAllItems();
and for configurable products I get the Parent Tshirt for example and the Selected Medium Tshirt. So I get 2 items instead of 1.
How do I get only the selected products from an order object?
What do you mean by “selected”. They did select the parent product w/ options leading to the child? If you’re looking for the parent item, look for the one with
type_idof “configurable”. If you want the child, you need the one with aparent_idwhich is not null.I’ll be happy to answer with code if you give more clarification.
Thanks,
Joe