Use the woocommerce_bookings_export_column_{column_id} filter when one exported column needs custom output for each booking row. Replace {column_id} with the column key you want to control. The snippet below targets a custom field column, checks that the expected column is being processed, and falls back to the original value when no custom meta value is available.
add_filter(
'woocommerce_bookings_export_column_my_custom_field',
function ( string $value, WC_Booking $booking, string $column_id ): string {
if ( 'my_custom_field' !== $column_id ) {
return $value;
}
$custom_value = get_post_meta( $booking->get_id(), '_my_custom_field', true );
if ( '' === $custom_value || ! is_scalar( $custom_value ) ) {
return $value;
}
return (string) $custom_value;
},
10,
3
);