Last active
February 23, 2023 03:53
-
-
Save abdulawal39/c18dbffaa4a05594a34af5c0cc31a01c to your computer and use it in GitHub Desktop.
Display additional fields data on booking details page woocommerce bookings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is helpful, thanks.
If we wanted to show the booking order comments (private notes) here - what would be the way to do that?