I am using some custom Item Meta for products sold on my WooCommerce store. I am looking for a way to hide the item meta from showing up on the Admin Order page, under the order items section.
I am using underscores for the meta name, however the meta is still showing up.
You can see in the attached image what I mean...
Thoughts?
You can try this:
function custom_woocommerce_hidden_order_itemmeta($arr) {
$arr[] = '_xchange_code';
return $arr;
}
add_filter('woocommerce_hidden_order_itemmeta', 'custom_woocommerce_hidden_order_itemmeta', 10, 1);
//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;
}
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