Get product custom fields in plugin I'm writing a plugin for Craft Commerece that performs action on commerce_orders.onOrderComplete

I need to check the value of product custom field (Matrix) in order to determine action parameters.

I tried to use $lineItem-&gt;purchasable-&gt;product-&gt;myCustomFieldHandle, but this returns me ElementCriteriaModel without any data entered for product in this field.

Any ideas on how to get actual data saved in custom field for product?
I am pretty sure it's the same for a product as it is for any other Craft element, like an entry.

To get simple fields:

$lineItem-&gt;purchasable-&gt;product-&gt;myCustomFieldHandle

To handle matrix fields, just loop through the matrix blocks:

$matrixBlocks = $lineItem-&gt;purchasable-&gt;product-&gt;matrixFieldHandle; 
foreach ($matrixBlocks as $block){
    echo $block-&gt;id;
    echo $block-&gt;fieldHandle;
    if ($block-&gt;fieldHandle == "whatever"){
          etc
    }
}


Certainly that works with SuperTable fields on a product, pretty sure it's the same with matrix fields.