好的,我找到了解决方案:
$slug = \'\';
$item_ = $this->item[\'item_meta\'];
foreach ($item_ as $meta_ => $term_)
{
if(substr($meta_,0,3) == \'pa_\' && $meta_ == $meta->key)
{
$slug = $term_[0];
break;
}
}
$formatted_meta[ $meta_id ] = array(
\'key\' => $meta->key,
\'label\' => wc_attribute_label( $attribute_key, $this->product ),
\'value\' => apply_filters( \'woocommerce_order_item_display_meta_value\', $meta->value ),
\'slug\' => $slug,
);