UBL Filter Hooks

Available filter hooks #

FilterParameter typesParameter description
wpo_wcpdf_ubl_tax_schemesarray $tax_schemes$tax_schemes is an array consisting of tax code strings mapped to label strings.
wpo_wcpdf_ubl_tax_categoriesarray $tax_categories$tax_categories is an array consisting of tax code strings mapped to label strings.
wpo_wcpdf_ubl_tax_reasonsarray $tax_reasons$tax_reasons is an array consisting of tax code strings mapped to label strings.

Important note #

  • When adding either a new tax scheme, category or reason, only key/value pairs with keys that don’t conflict with existing defaults will be allowed. This means that if a provided key already exists, it will be ignored.


Example: Add tax scheme #

add_filter( 'wpo_wcpdf_ubl_tax_schemes', 'wpo_wcpdf_add_tax_scheme', 10, 1 );
function wpo_wcpdf_add_tax_scheme( $tax_schemes ) {
	$tax_schemes['EV1']  = __( 'Tax EV1', 'woocommerce-pdf-invoices-packing-slips' );
	return $tax_schemes;
}

Example: Add tax category #

add_filter( 'wpo_wcpdf_ubl_tax_categories', 'wpo_wcpdf_add_tax_category', 10, 1 );
function wpo_wcpdf_add_tax_category( $tax_categories ) {
	$tax_categories['AB'] = __( 'AB tax category', 'woocommerce-pdf-invoices-packing-slips' );
	return $tax_categories;
}

Example: Add tax reason #

add_filter( 'wpo_wcpdf_ubl_tax_reasons', 'wpo_wcpdf_add_tax_reason', 10, 1 );
function wpo_wcpdf_add_tax_reason( $tax_reasons ) {
	$tax_reasons['reason']  = __( 'Some reason', 'woocommerce-pdf-invoices-packing-slips' );
	return $tax_reasons;
}