Woocommerce accessing protected data

I am trying to get the line items of an order. I’m doing this:

$order = new WC_Order(147);
foreach ($order->get_items() as $key => $lineItem) {
    print_r('<pre>----');
    print_r($lineItem);
    print_r('----</pre>');
}

I can see all the data I need but the array shows this:

[meta_data:protected] => Array

How can I access this array to get the values?

Read more here: Woocommerce accessing protected data

Leave a Reply

Your email address will not be published. Required fields are marked *