Make user_note Appear on Invoice Memo Line?

This topic contains 3 replies, has 4 voices, and was last updated by  Britton Pentakill 1 year, 2 months ago.

  • Author
    Posts
  • #3854

    Hi there!

    Using the insert_invoice function, I see that the user_note appears in the email that is generated and sent but I believe it would make sense for this to also appear in the memo lines of the printable/payable invoice.

    Is there a way to make this happen?

    Thanks

    #3856

    Alex Rollin
    Moderator
    Post count: 27815

    The developers will take a look at your question

    #3859

    Patrik
    Moderator
    Post count: 1971

    Hi,

    You can try the following code by putting in functions.php file of currently active theme or using Code Snippets plugin on backend:

    
    
    add_action('wpinv_invoice_print_after_line_items', 'wpinv_invoice_print_after_line_items_cb', 10, 1);
    function wpinv_invoice_print_after_line_items_cb($invoice){
        if(!$invoice){
            return;
        }
    
    	$notes = wpinv_get_invoice_notes( $invoice->ID );
    
    	echo '<ul class="invoice_notes">';
    
    	if ( $notes ) {
    		foreach( $notes as $note ) {
    			$is_customer_note = get_comment_meta( $note->comment_ID, '_wpi_customer_note', true );
    			if($is_customer_note) {
    				?>
                    <li rel="<?php echo absint( $note->comment_ID ); ?>" class="">
                        <div class="note_content">
    						<?php echo wpautop( wptexturize( wp_kses_post( $note->comment_content ) ) ); ?>
                        </div>
                    </li>
    				<?php
    			}
    		}
    
    	}
    
    	echo '</ul>';
    }

    Let me know if it helps or not.

    Regards,
    Patrik

    #3860

    Britton Pentakill
    Free User
    Post count: 1

    Thanks! That worked.

    — a bug with the site, however, is that I first logged in with Facebook and coming back to tell you that your code worked would not let me sign back in with Facebook. Had to connect with Google. Anyway, thanks again!

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Make user_note Appear on Invoice Memo Line?’ is closed to new replies, this may be for inactivity, please open a new topic if you have a similar question.