Developers - Filter Reference

WooCommerce PDF Invoice comes with several filter hooks that allow developers to extend functionality.

 

woo_pdf_generate_regular_invoice

Filter hook called just before generating regular invoice when order is being marked as completed. Simply return false from your callback function to cancel generating invoice.

Parameters: 

$proceed bool whether to proceed generating invoice or not
$order object current order object

 

woo_pdf_send_by_email

Filter hook called just before attaching PDF invoice to one of standard WooCommerce emails. Simply return false from your callback function to cancel generating invoice.

Parameters: 

$proceed bool whether to proceed generating invoice or not
$order object current order object
$email_type string WooCommerce email type, e.g. "customer_completed_order"

 

woo_pdf_allow_regular_invoice_download

Filter hook called just before displaying regular invoice download link or download button. Simply return false from your callback function to cancel generating invoice.

Parameters: 

$display bool whether to proceed displaying regular invoice download link or not
$order object current order object
$location string where download link is displayed ("single" - single order view; "list" - order list view)

 

woo_pdf_allow_proforma_invoice_download

Filter hook called just before displaying proforma invoice download link or download button. Simply return false from your callback function to cancel generating invoice.

Parameters: 

$display bool whether to proceed displaying proforma invoice download link or not
$order object current order object
$location string where download link is displayed ("single" - single order view; "list" - order list view)

 

woo_pdf_prefix_suffix_macros

Filter hook used to add additional macros to be used in invoice number prefix and suffix. Push additional elements to $macros array (macro key as array item key, replacement value as array value) and return it.

Parameters: 

$macros array contains invoice number prefix/suffix macros and their values
$order object current order object
$position string "prefix" or "suffix"

 

woo_pdf_macros

Filter hook used to add additional macros to be used in footer and custom content blocks. Push additional elements to $macros array (macro key as array item key, replacement value as array value) and return it.

Parameters: 

$macros array contains macros and their values
$order object current order object

 

Have more questions? Submit a request