WooCommerce hide order item meta from front end (not admin)

Tags: , , , ,

I have a couple of order item meta details that I would not like the customer to see (on the view orders page under account info). I have found a filter that will remove this data from the ADMIN (where I would still like to see it), but can’t find a similar filter to remove it from the FRONT END (where it should be hidden).

Here is the code that will (uselessly, for me) remove it from the back end admin:

add_filter( 'woocommerce_hidden_order_itemmeta', 'add_hidden_order_items' );
function add_hidden_order_items( $order_items ) {
    $order_items[] = 'paid_already';
    $order_items[] = 'variation_sku';
    // and so on...
    return $order_items;


Well, it ended up being much easier than I was supposing, the template actually already puts out a class with the name of my item meta, so I just hid it in the css like so:

.order_details .variation-variation_sku, .order_details .variation-paid_already {
    display: none !important;

While it would be nice to know how to prevent these item meta from ever being output, I can live with this as a solution.

Source: stackoverflow