To show custom order note programmatically in Woocommerce admin order details page you need to use ‘woocommerce_thankyou’ action hook. Here is the complete code:
function add_custom_order_notes( $order_id ) {
$order = wc_get_order( $order_id );
// Text for the note
$note = __("This is my test note", 'text-domain');
// Add note
$order->add_order_note( $note );
};
add_action( 'woocommerce_thankyou', 'add_custom_order_notes', 10, 1 );
Published by Assaduzzaman Khan
Assaduzzaman Khan is a Web and Web Application developer, author, and instructor.He has more than 11 years of practical experience with Web and Web Application development. He has Detail-oriented and knowledgeable in various programming languages. Expert in all aspects of WordPress website creation, including design, Plugin development, and implementation. Connect with Assaduzzaman Khan here.
View all posts by Assaduzzaman Khan