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 custom user field called customer_order_note on user level. The code bellow don’t work since there is no $data[‘order_note’] in $data array… $customer->get_meta(‘customer_order_note’) is fine and it shows my custom order note per user. 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;
}
Leave an answer