• Resolved Angela2601

    (@angela2601)


    I would like to change the order note on the view order page when a new order is created but only when the payment method is cash on delivery. The code below can change the order note but I can’t figure out how to do it only for cash on delivery. If not cash on delivery then the normal order note should still appear.

    add_action( 'woocommerce_new_order', 'add_engraving_notes' );
    function add_engraving_notes( $order_id ) {
    	//note this line is different
    	//because I already have the ID from the hook I am using.
    	$order = wc_get_order( $order_id );
    
    	// The text for the note
    	$note = 'No special message yet';
    
    	// Add the note
    	$order->add_order_note( $note );
    
    	// Save the data
    	$order->save();
    }
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change Order Note’ is closed to new replies.