I was under the impression that if you add an underscore to your meta_key, it would be hidden from the Admin and subsequently the Order Receipts, etc.

But, mine are showing? I don't understand what's going on...

meta_key: _testing_this, meta_value: asdasdasd

How do I added order item meta without it showing up?


The answer is to serialize the data you want to be hidden for sure.


My solution:

//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, [
                ] ) ) {
                $temp_metas[ $key ] = $meta;
        return $temp_metas;
  • You should add a helpful content to better understand the solution without reading the source. – bueltge Aug 16 '17 at 11:21
  • I think it's enough easy to understand for anyone. – Hà Bầu Aug 17 '17 at 6:09

You'll want to add to the hidden item meta array as such:

   array($this, 'hidden_order_itemmeta'), 50);

function hidden_order_itemmeta($args) {
  $args[] = 'my_hidden_meta';
  return $args;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.