php - Display custom meta data in WooCommerce admin order after billing address
one text
Solution:
The problem comes from $order->id
, so try the following instead:
add_action('woocommerce_admin_order_data_after_billing_address', 'wps_select_checkout_field_display_admin_order_meta', 10, 1 );
function wps_select_checkout_field_display_admin_order_meta( $order ) {
$delivery_time = $order->get_meta('delivery_time');
if ( ! empty($delivery_time) ) {
echo '<p><strong>'.__('Requested Delivery Time').':</strong> ' . $delivery_time . '</p>';
}
}
Now it should work.
Source