In the function file, I created the code. Task: add order data to the email alert. There is no registration on the site. I want to do this as a table with tittle. I found a similar question. But in it all the data is taken from the module's metadata. And I have metadata and default information together. Not need to write all html. Just push me in the right direction how correct write my data.
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['billing_first_name'] = array(
'label' => __( 'Name' ),
'value' => $order->get_billing_first_name(),
);
$fields['billing_phone'] = array(
'label' => __( 'Phone' ),
'value' => $order->get_billing_phone(),
);
$fields['billing_address_1'] = array(
'label' => __( 'Street' ),
'value' => $order->get_billing_address_1(),
);
$fields['billing_address_2'] = array(
'label' => __( 'Build' ),
'value' => $order->get_billing_address_2(),
);
$fields['billing_address_3'] = array(
'label' => __( 'Apartment' ),
'value' => get_post_meta( $order->id, 'Apartment', true ),
);
$fields['billing_address_4'] = array(
'label' => __( 'Floor' ),
'value' => get_post_meta( $order->id, 'Floor', true ),
);
$fields['billing_address_5'] = array(
'label' => __( 'Entrance' ),
'value' => get_post_meta( $order->id, 'Entrance', true ),
);
$fields['customer_message'] = array(
'label' => __( 'Note' ),
'value' => $order->customer_message,
);
return $fields;
}