How do I hide 'Order Item' meta?

In order to hide the order item meta from the invoice, simply add the following filter to your themes  functions.php

/**
 * Hide order itemmeta on WooCommerce PDF Invoices' invoice template.
 *
 * @param array $hidden_order_itemmeta itemmeta.
 *
 * @return array
 */
function bewpi_alter_hidden_order_itemmeta( $hidden_order_itemmeta ) {
    $hidden_order_itemmeta[] = '_wc_cog_item_cost';
    $hidden_order_itemmeta[] = '_wc_cog_item_total_cost';
    $hidden_order_itemmeta[] = '_subscription_interval';
    $hidden_order_itemmeta[] = '_subscription_length';
    // end so on..
    return $hidden_order_itemmeta;
}
add_filter( 'bewpi_hidden_order_itemmeta', 'bewpi_alter_hidden_order_itemmeta', 10, 1 );<br>
	

Please test the functionality on a development environment of your website. If it ceases to work, please revert back to the original state of your website and follow the tutorial again.

Still need help? Contact Us Contact Us