Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save abdulawal39/c18dbffaa4a05594a34af5c0cc31a01c to your computer and use it in GitHub Desktop.
Save abdulawal39/c18dbffaa4a05594a34af5c0cc31a01c to your computer and use it in GitHub Desktop.
Display additional fields data on booking details page woocommerce bookings
<?php
/**
* Display additional fields data on booking details page, fields added using
* Checkout Field Editor (Checkout Manager) for WooCommerce plugin
* @author Abdul Awal Uzzal
* @url abdulawal.com
*/
function tnc_display_additional_checkout_info($booking_id){
$booking = new WC_Booking($booking_id);
$order_id = $booking->get_order_id();
$order = new WC_Order($order_id);
$output = "<h3 style='padding-top: 30px; clear:both;'>Student Details</h3>";
$output .= '<p> <strong>Field 1 Label </strong><br><br /> '.$order->get_meta("additional_field_one").'</p>';
$output .= '<p> <strong>Field 2 Label Name</strong> <br><br /> '.$order->get_meta("additional_field_two").'</p>';
echo $output;
}
add_action( 'woocommerce_admin_booking_data_after_booking_details', 'tnc_display_additional_checkout_info', $priority = 10, $accepted_args = 1 );
?>
@solaceten
Copy link

This is helpful, thanks.
If we wanted to show the booking order comments (private notes) here - what would be the way to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment