How do you add a user custom field into Woocommerce emails?
This is my code so far in functions.php
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['meta_key'] = array(
'label' => __( 'Store number' ),
'value' => get_user_meta( $user_id, 'wpcf-store-number', true ),
);
return $fields;
}
The user custom field is wpcf-store-number which is already in the database. All I need to do now is to show it in the order confirmation email / New order email.