0

I want to filter out unwanted order item meta data from Woocommerce email notifications especially gravity forms field labels. With gravityforms and gravity forms product add on it is possible that any customer can engrave a product.
licence plates for cars etc.
e.g. eins:M zwei:TU drei:2019 .
I want to hide the field labels (eins, zwei, drei) and the double points in the email-notifications.
https://einsautoschilder.de/wp-content/uploads/2019/09/itemmeta.png

With dt.variation{display:none;} CSS rule I can hide the labels on cart and checkout page, but not in the emails.

  • You can **override WooCommerce templates via your theme**, see [this related official documentation](https://docs.woocommerce.com/document/template-structure/) to understand how… Once done you should edit the template [`emails/email-styles.php`](https://github.com/woocommerce/woocommerce/blob/3.7.0/templates/emails/email-styles.php) and add the necessary CSS rule to it, to be able to hide what you want from the WooCommerce emails. – LoicTheAztec Sep 07 '19 at 18:48
  • Thank you for your support. now i can style the emails and the added input to the products. – Johannes Dahm Sep 08 '19 at 14:16

1 Answers1

0

To learn more about woocommerce order item meta data i found a very good tutorial by Igor Benic. "How to manage order item data in WooCommerce" | https://www.ibenic.com/manage-order-item-meta-woocommerce

With the following code it is possible

1) to hide gravityform field labels from woocommerce email notifications,

2) to change the order item meta title

add_filter( 'woocommerce_order_item_display_meta_key',    'change_order_item_meta_title', 20, 3 );
/**
* Changing a meta title
* @param  string        $key  The meta key
* @param  WC_Meta_Data  $meta The meta object
* @param  WC_Order_Item $item The order item object
* @return string        The title
*/
function change_order_item_meta_title( $key, $meta, $item ) {

// By using $meta-key we are sure we have the correct one.
if ( 'eins' === $meta->key ) { $key = ''; }

return $key;
}

the code works in functions.php of your theme