WooCommerce Add Order Note Programmatically

Today we will talk about how to Add an Order Note Programmatically on WooCommerce. Sometimes, we need to add a note for an order. To create an order note, it is necessary to have access to the order ID first in order to proceed.

Below is an example:

$orderId = 20;
   $orderObject = wc_get_order( $orderId ); // get Order object by order id
 $orderNote = __("This is order note's text…"); // add note text
$orderObject->add_order_note( $orderNote, $is_customer_note = 0, $added_by_user = false);

Search

Recent Blogs

Categories

Archives

Archives

Tags