I am trying to get all the order data. So I came across these three different types of methods to get items from an order

  • getItems()
  • getAllItems()
  • getAllVisibleItems()

I tried the first two getItems() and getAllItems , they give me double entries of order

  • One with no size
  • Another with 0 price


    foreach ($orderInfo->getAllItems() as $item):?>
    // code to get all order attributes
    <?php endforeach; ?>

double order details entry

and when I tried last option getAllVisibleItems() I get a single entry(which I need), but size is missing.


    foreach ($orderInfo->getAllVisibleItems() as $item):?>
    // code to get all order attributes
    <?php endforeach; ?>

enter image description here

So on some exploration, I found that getAllVisibleItems() gives me configurable product which doesn't have the size,

So how can I get all order details in a single entry which contain every order related details

Item Name , Size , Quantity , Price I am puzzled how can I get all these details.


1 Answer 1


Using getAllVisibleItems() is the right way. If you have a configurable product you can get the configured options with the following code:

if ($item->getProductType() == 'configurable'){
    $options = $item->getProductOptions()['attributes_info'];

There you find an array with the following structure in case of a configurable product - what you need for frontend are all the lables and values of the elements of this array:

[0] => Array
        [label] => Size
        [value] => XS
        [option_id] => 141
        [option_value] => 167

[1] => Array
        [label] => Color
        [value] => Red
        [option_id] => 93
        [option_value] => 58

  • 1
    Do you know how I would get the same infor but for a bundle product?
    – ItsJhonny
    Jul 7, 2020 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.