I need to get the value of ntva
from this Object but I can't figure out how to do it.
Meta_data Object ( [current_data:protected] => Array ( [id] => 99769 [key] => ntva [value] => SRTTE ) [data:protected] => Array ( [id] => 99769 [key] => ntva [value] => SRTTE ) );
Foreach ($data->current_data as $key => $value){
echo $key.', value'.$value.'<br/>';
}
This foreach does not show me anything.
This object comes from WooCommerce (e-commerce wordpress plugin) ORDER data array. I need the ntva
value to display it in PDF invoice.
Looking at the source, WC_Meta_Data
has a getter __get
, so you will be able to access it like:
$data->key
which will output ntva
Or use the get_data() method:
foreach ($data->get_data() as $key => $value){
echo $key.', value'.$value.'<br/>';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With