Is there another method to return meta values for custom attributes that doesn't return a protected array
foreach ($order->get_items() as $item_key => $item_values) {
$item_id = $item_values->get_id();
$item_meta_data = $item_values->get_meta_data();
var_dump($item_meta_data);
}
It outputs:
object(WC_Meta_Data)#3433 (2) {
["current_data":protected]=>
array(3) {
["id"]=>
int(4690)
["key"]=>
string(14) "pa_second-half"
["value"]=>
string(11) "nutty-butty"
}
I've also tried this
$item_meta_data = $item_values->get_data();
$item_meta_data['key']
Which returns NULL.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…