Error generating invoices | WordPress.org

[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 😉

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer