I am getting a WooCommerce order product meta_data like this...
$item_meta_data = $item_values->get_meta_data();
This gives me the following...
WC_Meta_Data Object
(
[current_data:protected] => Array
(
[id] => 8795
[key] => Option 1
[value] => Yes
)
[data:protected] => Array
(
[id] => 8795
[key] => Option 1
[value] => Yes
)
)
I am confused about the data that is returned, I want to check if Option 1 is set, I have tried to get the key like this...
foreach($item_meta_data as $meta_data_item) {
echo $meta_data_item['key'];
}
But this is not working as it is not an array, anyone any ideas?