Question: 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?

Answer: 
There is a magic method in `WC_Meta_Data` class named `__get` .

So you can access protected properties. For example:

```
$item_meta_data->key

```
You can access all the data with `$item_meta_data->get_data()` or one specific item with `$item_meta_data->id` or `$item_meta_data->key` or `$item_meta_data->value`.