Hide metadata from order items on admin order page (WooCommerce)
I am using some custom Meta elements for products sold in my WooCommerce store. I'm looking for a way to hide the meta element from displaying on the Admin Order page under Order Items.
I am using underscores for the meta name, however the meta still appears.
In the attached image, you can see what I mean ...
Thoughts?
+3
source to share
2 answers
//remove order item meta key
add_filter( 'woocommerce_order_item_get_formatted_meta_data', 'mobilefolk_order_item_get_formatted_meta_data', 10, 1 );
function mobilefolk_order_item_get_formatted_meta_data($formatted_meta){
$temp_metas = [];
foreach($formatted_meta as $key => $meta) {
if ( isset( $meta->key ) && ! in_array( $meta->key, [
'lyric_id',
'lyric_song_title',
'lyric_artist_name'
] ) ) {
$temp_metas[ $key ] = $meta;
}
}
return $temp_metas;
}
0
source to share