Hi,
I am not really a developer and have been doing a lot of research and trial and error but can’t seem to figure out my problem.
I would like to add a field (datepicker and is added to woocommerce products) to the invoices that are generated and attached to emails.
The field that I would like to add is called “Begindatum”.
Any idea if this is possible or not?
Thanks!
HI @yett
I think you would need to add the field to the order not the product.
You then need to add the code to the emails:
/**
* Add a custom field (in an order) to the emails
*/
add_filter( 'woocommerce_email_order_meta_fields', 'custom_woocommerce_email_order_meta_fields', 10, 3 );
function custom_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
$fields['Begindatum'] = array(
'label' => __( 'Begin Datum' ),
'value' => get_post_meta( $order->id, 'Begindatum', true ),
);
return $fields;
}
If you’re using a plugin for the invoices, you may need to check if they have any hooks
Hi,
Thanks I’ll see if I can figure this out with your code!
Thanks You!