Hello,
I’m using both Woocommerce Germanized Pro and Woocommerce EU VAT Number plugins and for some reason, the VAT ID added by the Woocommerce EU VAT Number plugin is not appearing on the address in the PDF Invoices generated by Germanized. The field appears correctly on other places, such as the address in the checkout page and in the backend order edit page.
I’ve seen that the Woocommerce EU VAT Number is using these filters to add the vat field:
// Add VAT to addresses.
add_filter( 'woocommerce_order_formatted_billing_address', array( __CLASS__, 'formatted_billing_address' ), 10, 2 );
add_filter( 'woocommerce_formatted_address_replacements', array( __CLASS__, 'output_company_vat_number' ), 10, 2 );
add_filter( 'woocommerce_localisation_address_formats', array( __CLASS__, 'localisation_address_formats' ), 10, 2 );
public static function formatted_billing_address( $address, $order ) {
$vat_id = wc_eu_vat_get_vat_from_order( $order );
if ( $vat_id ) {
$address['vat_id'] = $vat_id;
}
return $address;
}
public static function output_company_vat_number( $formats, $args ) {
if ( isset( $args['vat_id'] ) ) {
$formats['{vat_id}'] = sprintf( __( 'VAT Number: %s', 'woocommerce-eu-vat-number' ), $args['vat_id'] );
} else {
$formats['{vat_id}'] = '';
}
return $formats;
}
public static function localisation_address_formats( $formats ) {
foreach ( $formats as $key => $format ) {
if ( 'default' === $key || in_array( $key, self::get_eu_countries() ) ) {
$formats[ $key ] .= "\n{vat_id}";
}
}
return $formats;
}
While debugging, the $address[‘vat_id’] field is just empty on the pdf invoices. Any idea where I can check or what could be the reason for that?