On one of my websites I use the Flexible Checkout Fields for WooCommerce to make 20 custom fields. Two of them needed to be a select/dropdown field. I wasn't able to do so via the plugin (didn't want to pay for it. Regret that decision now. It is horrible); so I used the first-name and last-name default tags from WooCommerce to make them into a select field. I use them to select the Mr/Mrs title before the name.
The emails now only show the first-name and last-name fields, as where I would like to have the first-name (Mr/Mrs title select) and my new custom field for the first name.
I found the code below in admin-new-order.php;
<p><?php printf( __( 'You have received an order from %s. The order is as follows:', 'woocommerce' ), $order->get_formatted_billing_full_name() ); ?></p>
as where $order->get_formatted_billing_full_name()
will display the billing first-name and billing last-name.
Is there a way to display billing first-name and my custom field? And if so, how?
Thanks in advance.
You will need to replace in
emails/admin-new-order.php
template the following (on line 28):By this code (where
_billing_voornaam_1_24
is the meta_key of your custom field):This should work if
_billing_voornaam_1_24
custom field exists for the order…