Based on this description, I made a custom dropdown field to the WooCommerce Checkout Page.
I would like to see this value among the metadata in Woocommerce Bookings plugin. Bookings: Action and Filter reference
add_action( 'woocommerce_admin_booking_data_after_booking_details', 'wps_select_checkout_field_display_booking_order_meta');
function wps_select_checkout_field_display_booking_order_meta($order){
echo '<p><strong>'.__('Communication').':</strong> ' . get_post_meta( $order->id, 'comm_plat', true ) . '</p>';
}
But I only see the 'Communication:' text, without the value. Can anyone help me with this?
Taking a look at your
echostatement the following are possible reasons you are not seeing the value:1:
'comm_plat'is not save topost_metaas such it is returning empty string2:
'comm_plat'might be wrongly spelled when saving the value which means you are querying with a wrong name3: On the link you provided there is no hook with the name
woocommerce_admin_booking_data_after_booking_detailsthe closest to that waswoocommerce_admin_order_data_after_billing_address4: Is the
$orderparameter passed to the hooked (you can know this by printing out the$ordervariable like so: