Hide the meta data (To / From / Message)

If you do not want the meta data to display in the Cart and Order pages (including the Order email), follow these steps:

1. Download the free Code Snippets plugin: https://wordpress.org/plugins/code-snippets/
2. Create a Snippet with the following code:

Note: You can optionally add this to your functions.php if you’re more familiar with that process instead of using Code Snippets.

function hide_gc_meta_data() {
	global $pw_gift_cards_purchasing;

	remove_filter( 'woocommerce_get_item_data', array( $pw_gift_cards_purchasing, 'woocommerce_get_item_data' ), 10, 2 );
}
add_action( 'woocommerce_init', 'hide_gc_meta_data', 99 );

function hide_gc_woocommerce_display_item_meta( $html, $item, $args ) {
	if ( is_a( $item, 'WC_Order_Item_Product' ) ) {
		$product = wc_get_product( $item->get_product_id() );

		if ( is_a( $product, 'WC_Product_PW_Gift_Card' ) ) {
			return '';
		}
	}

	return $html;
}
add_filter( 'woocommerce_display_item_meta', 'hide_gc_woocommerce_display_item_meta', 99, 3 );
Skip to content