Skip to content

Instantly share code, notes, and snippets.

@wtmujeebu
Created April 16, 2021 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wtmujeebu/a182a69975aa3e237455a7e3d056f0d1 to your computer and use it in GitHub Desktop.
Save wtmujeebu/a182a69975aa3e237455a7e3d056f0d1 to your computer and use it in GitHub Desktop.
Alter PDF file name - WebToffee PDF invoice plugin for WooCommerce
<?php
add_filter( 'wf_pklist_alter_pdf_file_name ', 'wt_pklist_change_pdf_name', 10, 3 );
function wt_pklist_change_pdf_name( $name, $template_type, $order_ids ) {
if ( $template_type == 'invoice' ) {
if ( count( $order_ids ) > 1 ) {
$name = 'facture_bulk_' . implode( '-', $order_ids );
} else {
$name = 'facture_' . $order_ids[ 0 ];
}
}
if ( $template_type == 'proformainvoice' ) {
if ( count( $order_ids ) > 1 ) {
$name = 'factureproforma_bulk_' . implode( '-', $order_ids );
} else {
$name = 'factureproforma_' . $order_ids[ 0 ];
}
}
return $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment