I have a plugin for Woocommerce for custom metas. I have four but two of them shouldn't be shown in the customer E-Mails (but in my backend). So I try to edit the email-order-items.php and delete the standard wc_display_item_meta( $item ); In the first part of my code I try to delete two of them and in the second part I try to display the other two
$_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
$item_meta = wc_gzdp_get_order_meta($_product, $item);
$item_meta_print = '';
if ($item_meta->meta) {
if (is_array($item_meta->meta)) {
foreach ($item_meta->meta as $key => $value) {
if (stripos($key, "_wccf_pf_donotshow") === 0 ||
stripos($key, "_wccf_pf_donotshow2") === 0) {
unset($item_meta->meta[$key]);
}
}
}
$item_meta_print = $item_meta->display(true, true, '_', ", ");
if(isset($item_meta->meta['_wccf_pf_show'])) {
$item_meta_print .= ', Name: '. $item_meta->meta[_'wccf_pf_show'];
} elseif(isset($item_meta->meta['_wccf_pf_show2'])) {
$item_meta_print .= ', Name2: '. $item_meta->meta['_wccf_pf_show2'];
}
}
This works fine with previous Woocommerce version but not any longer in Woocommerce 3. No metas anymore in the customer E-Mails :-(
I would be so grateful for any help.