I have a code i have done to display custom field value on thank you page but it does not display the value. However i am able to display the value on the backend admin page. Below is my code:
add_action( 'woocommerce_thankyou_order_received_text', 'additionalnote_order_data_in_admin', 10, 1 );
function additionalnote_order_data_in_admin( $order ){
global $wpdb;
global $post_id;
$order = new WC_Order( $post_id );
$table_name = $wpdb->prefix . 'woocommerce_custom_fields';
$result = $wpdb->get_results("SELECT * FROM $table_name ");
if(!empty($result)){
foreach($result as $query){
$name = $query->name;
$label = $query->label;
$get_order = $order->get_meta('_'.$name);
echo '<p><strong>'.__('Delivery Date').':</strong> ' . $get_order . '</p>';
}
}
}