Based on "Choosing a date and time after choosing the WooCommerce delivery method" answer code, that displays custom Pickup fields and delivery dates, the following code displays the delivery data of those fields on the order edit pages.
Here is my code:
// View fields in Edit Order Page
add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_fields_order_meta', 10, 1 );
function my_custom_fields_order_meta($order){
$delivery_option = $order->get_meta('_delivery_option');
if( $delivery_option == 'date' ) {
$delivery_datetime = $order->get_meta('_delivery_datetime');
echo '<p><strong>'.__('Delivery').':</strong> ' . get_post_meta( $order->id, '_delivery_option', true ) . '</p>';
echo '<p><strong>'.__('Delivery Date').':</strong> ' . get_post_meta( $order->id, '_delivery_datetime', true ) . '</p>';
}
}
Unfortunately, only the delivery date that the customer chooses is displayed correctly, and the options of the radio button "As Soon As Possible" are not shown.
Apparently, I'm doing something wrong.
I would like also to display these fields values on the Thank You page and in the email.
Any help is appreciated.