• On the backend order page it’d be good to be able to easily see if/when an automatic transactional email has been sent. There must be an easy way to hook into add_order_note when an automatic email is sent? Maybe just including the email title.

    We’re already using an email logging tool, but a quick overview on each order page would be very useful, rather than having to trawl through all sent emails.

    • This topic was modified 4 years, 1 month ago by 63N.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter 63N

    (@63n)

    Would something along these lines work?

    add_action( 'woocommerce_new_order', 'custom_add_order_note' );
    function custom_add_order_note( $order_id ) {
    
    	$order = wc_get_order( $order_id );
    
    	// The email heading for the order note
    	$order_note = get_heading();
    
    	// Add the order note
    	$order->add_order_note( $order_note );
    
    }

    Reference.

    • This reply was modified 4 years ago by 63N.
    Thread Starter 63N

    (@63n)

    Anybody?

    Thread Starter 63N

    (@63n)

    I think I’ve found the right WooCommerce hook. This is tested and working for new paid orders…

    add_action( 'woocommerce_order_status_pending_to_processing_notification', 'custom_add_note_order_prcesssing' );
    
    function custom_add_note_order_prcesssing( $order_id ) {
        
        $order = wc_get_order( $order_id );
            
        // The text for the note
        $note = 'Customer email sent: order recieved';
    
        // Add the note
        $order->add_order_note( $note );
    
    }

    I’d like to include the email title and/or subject in the note too if anyone can help with that?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add admin note when automatic emails are sent’ is closed to new replies.