To add a custom order note programmatically to a WooCommerce order (visible on the admin order details page), we need to insert the note after the user completes the checkout process.
Add Order Note in WooCommerce Programmatically
We can do this using the ‘woocommerce_thankyou’ action hook like the one below:
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 );
When the user completes the checkout process, the user is redirected to the WooCommerce thank you page, and then an action hook named woocommerce_thankyou is run. So the attached callback function can perform tasks, as shown above. First, it calls the wc_get_order( $order_id ) function to get the $order object and then calls the add_order_note() function associated with the $order object to add the order note.
Order Note Output Example
In the order details page, in the right sidebar area of the admin screen, you can see the order note as shown below:

Plugins to Enhance Your WooCommerce Store
Carefully selected tools to help you customize, manage, and optimize your WooCommerce experience.
Woo Parent Category Selector
- Automatically assign parent categories when child categories are selected
- Prevent accidental removal of required parent categories
- Automatically repairs missing parent category assignments during product save
- Bulk repair existing WooCommerce product category structures
- Keeps product category structures organized and consistent
Product Catalog Mode For WooCommerce
- Turn your WooCommerce store into catalog mode instantly
- Hide Add to Cart buttons and product prices conditionally
- Apply rules by user role, country, or scheduled time periods
- Display custom messages and inquiry options for products
- Control visibility settings globally or per product
Remove Add to Cart Button for WooCommerce
- Remove Add to Cart buttons from shop and product pages
- Hide buttons conditionally for selected products or categories
- Replace Add to Cart with custom text or messages
- Control button visibility by user role and product type
- Lightweight settings interface with easy customization
Remove Product Content for WooCommerce
- Hide product title, image, price, rating, and descriptions
- Remove tabs, meta information, SKU, tags, and related products
- Control visibility separately for shop and single product pages
- Customize WooCommerce layouts without coding
- Enable or disable content elements with simple settings
Really Simple XML and HTML Sitemap
- Generate both XML and HTML sitemaps automatically
- Display sitemaps anywhere using ShortCode support
- Include pages, posts, and custom post types
- Exclude selected pages or posts easily
- Supports WPML and Polylang multilingual plugins
