Hello @astral4ik,
Are you using a custom PDF template (created by you)? If that is not your objective, you should use our available Action and Filter Hooks. 🙂
If you modify the plugin files directly, your changes will be lost on the next plugin update. 🙁
For your purpose, we will use an Action Hook.
add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_order_notes', 10, 2 );
function wpo_wcpdf_order_notes ( $template_type, $order ) {
if ( $template_type == 'packing-slip' ) {
$document = wcpdf_get_document( $template_type, $order );
$document->order_notes();
}
}
Documentation: Displaying Order Notes with a Template Hook
If you haven’t worked with code snippets (actions/filters) or functions.php before, read this guide: How to use Hooks
-
This reply was modified 2 years, 6 months ago by
Darren Peyou. Reason: correction, more permalinks
So it doesnt work for me
I need DOCUMENT NOTES to packing slips. Order notes (what customers write onto order) works well and shows. Document notes are what the administrator writes in the order. I need to packing slips shows it for our paching workers.
so i modified your snippet
add_action( ‘wpo_wcpdf_after_customer_notes’, ‘wpo_wcpdf_DOCUMENT_notes’, 10, 2 );
function wpo_wcpdf_DOCUMENT_notes ( $template_type, $order ) {
if ( $template_type == ‘packing-slip’ ) {
$document = wcpdf_get_document( $template_type, $order );
$document->DOCUMENT_notes();
}
}
but it doesnt work for me
It shows in INVOICE, but i need it ti shows in the PACKING SLIPS too
Plugin Contributor
dwpriv
(@dwpriv)
You can try this updated snippet
add_action( 'wpo_wcpdf_after_order_details', 'wpo_wcpdf_order_notes', 10, 2 );
function wpo_wcpdf_order_notes ( $template_type, $order ) {
if ( $template_type == 'packing-slip' ) {
$document = wcpdf_get_document( 'invoice', $order );
echo $document->document_notes();
}
}
Let us know how it works for you