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


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: