I use the “WooCommerce PDF Invoices & Packing Slips” plugin, available on the WP Repository, to invoice my clients. At times, for accounting purposes, I need to show the VAT/TAX ID of the client on the PDF invoice.
So, I open the order via WooCommerce > Orders, open the order I want to edit, add a “Note to the Customer” from the right hand side… and then have the following snippet in my functions.php adding such information on the PDF invoice!
/** * @snippet Add "Note to Customer" @ WooCommerce PDF Invoice * @how-to Get CustomizeWoo.com FREE * @sourcecode https://businessbloomer.com/?p=21728 * @author Rodolfo Melogli, Hans Schuijff @ dewitteprins.nl * @compatible WC 3.1.0, Woo P.I.P.S. 2.0+ * @community https://businessbloomer.com/club/ */ add_action( 'wpo_wcpdf_after_order_details', 'bbloomer_add_note_to_customer_to_PDF_invoice_new', 10, 2 ); function bbloomer_add_note_to_customer_to_PDF_invoice_new( $template_type, $order ) { $document = wcpdf_get_document( $template_type, $order ); $document->order_notes(); }
And here’s the final result:
I’ve been trying to find this solution, but for the invoices and packing slip plugin that webtoffee makes. And it’s driving me up a wall. Why on earth did woocommerce decide to use post comments as the order notes instead of using postmeta???
Any ideas on how I can get it to work on the plugin I’m using? Hopefully you’ve used it before.
I’m sure WebToffee will be happy to help
worked 100%
Cool
Hello its not working now can you check ?
Works for me. Which PDF plugin are you using?
Hello
Thanks a lot for all your tips – very useful !
This one does not work for me either – I use Woocommerce Pdf Invoices Packing Slips.
Could you please double-check if one of the latest Woocommerce updates have not impactd your snippet ?
Thanks
Nick
Hi Nick, seems https://docs.wpovernight.com/woocommerce-pdf-invoices-packing-slips/displaying-order-notes/ states the same. In case contact the plugin dev?
Thanks as always. I am having difficulty understanding if each of the two snippets goes into the child theme functions.php? When I added both nothing seemed to appear in the pdf invoice. Thanks.
Hey Adam, thanks for your comment! I removed the second snippet as it’s obsolete now, so you need to use just the first one. Order notes should appear on PDF invoices, unless something has changed in the plugin coding. Please note only “Notes to customer” will show (and not the other kind of notes). Test this out and let me know ๐
Thanks for sharing your WP code snippets, very useful.
You’re welcome!
thanks for that snippet, works fine. Only thing is: it shows “Note to client” on the Invoice as well, followed by the actual note.
Is there an easy way to get rid of the “Note to client” part?
Hello Chris, thanks so much for your comment! Yes, this is possible – but unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
I want to do something similar with this plugin but do not know how to write the code!
I want to add the customer’s email to the packing list right underneath the shipping method. I cannot figure out how to do it for the life of me.
Hey Linda, thanks for your comment! Have you tried asking the plugin’s support team?