Hi. How can we help?

How to show order notes in the invoice

By default WooCommerce order notes are not showed in the invoice.
If you want include them please add following code to the file functions.php of your theme.
add_action('yith_ywpi_template_order_content','yith_pdfi_show_order_note');

function yith_pdfi_show_order_note( $document ){
global $wpdb;
$order_id = $document->order->get_id();
$invoice_details = new YITH_Invoice_Details( $document );
$comment_table = $wpdb->prefix . 'comments';
$results = $wpdb->get_results( 'SELECT * FROM '. $comment_table .' WHERE comment_post_ID = '. $order_id .'', OBJECT );
if( !empty( $results ) ){
echo '<b>Order note</b>'.'<br>';
foreach ( $results as $comment ){
echo $comment->comment_content ."<br>";
}
}
}
The code take all order notes added to the order manually or automatically by the system .
01.png
 
 
Was this article helpful?
0 out of 0 found this helpful

Back to Help Center >

Powered by Zendesk