Site icon Hip-Hop Website Design and Development

Pre-fill Order Note when creating order from admin

I`m trying to pre-fill the Customer provided order note when creating order in Woocommerce admin.

The normal shipping and billing fields as usual are pre-filled when you choose a customer, however I have hard time finding how to pre-fill the Customer provided note before creating the order.

I have, of course, set and saved custom user field called customer_order_note on user level which I’m retrieving it from the customer meta data.

The code bellow however don’t work since there is nothing pointing to the order_note in the $data array.

Anybody?

add_filter('woocommerce_ajax_get_customer_details', 'add_custom_fields_to_ajax_customer_details', 10, 3);
function add_custom_fields_to_ajax_customer_details($data, $customer, $user_id){
    $data['order_note'] = $customer->get_meta('customer_order_note');
    return $data;        
}