I need to include custom data in an email for a Woocommerce site. Namely delivery date and time.
I have tried to override the existing hook “woocommerce_email_order_meta” using this code, I’ve temporarily written it in functions.php before moving to plugin file when its working.
remove_action('woocommerce_email_order_meta', 'woocommerce_email_order_meta', 10, 4);
add_action('woocommerce_email_order_meta', 'custom_email_order_meta', 10, 4);
function custom_email_order_meta($order, $sent_to_admin, $plain_text, $email) {
echo "Custom Text: This is my custom text.n";
}
When I test the email, the custom text line is printed. However the original content of the WC Hook is also printed underneath.
Is there any way to completely override the WC hook, do I have to try and create a new one? If I create a new one, will it be listed in the email editor so I can drop in the hook?
Thanks