Created
April 16, 2021 06:30
-
-
Save wtmujeebu/a182a69975aa3e237455a7e3d056f0d1 to your computer and use it in GitHub Desktop.
Alter PDF file name - WebToffee PDF invoice plugin for WooCommerce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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