[ad_1]
Hi @pozoalcon,
This issue is happening because in the last release, v3.6.3, we have deleted legacy code that we were maintaining for years. Currently, the global variable $wpo_wcpdf no longer exists, that is why the error is generated.
That said, I have updated your code snippet, so it is working again following our current standards:
/**
* PDF Invoices & Packing Slips for WooCommerce:
* Incluye el NIF en los documentos PDF (dentro de los datos de facturación)
*/
add_filter( 'wpo_wcpdf_billing_address', function( $address, $document ) {
if ( ! empty( $document ) && is_callable( array( $document, 'get_custom_field' ) ) && ( $nif = $document->get_custom_field( 'NIF' ) ) ) {
$address .= sprintf( '<p>NIF: %s</p>', $nif );
}
return $address;
}, 10, 2 );Let us know whether it worked or you need more tweaks 😉
