Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mircobabini/64ead066b22575f6948d133c82500555 to your computer and use it in GitHub Desktop.
Save mircobabini/64ead066b22575f6948d133c82500555 to your computer and use it in GitHub Desktop.
<?php
add_action( 'wpo_wcpdf_billing_address', function ( $billing_address, $invoice ) {
if ( ! empty( $invoice ) ) {
$billing_address_prefix = '';
// billing_company
$company_name = trim( $invoice->order->get_meta( '_billing_company', true, 'view' ) );
if ( ! empty( $company_name ) ) {
$billing_address_prefix .= "<b>$company_name</b><br>";
}
$company_vat = trim( $invoice->order->get_meta( '_billing_wooccm11', true, 'view' ) );
if ( ! empty( $company_vat ) ) {
$billing_address_prefix .= "<b>PIVA: $company_vat</b><br>";
}
if ( ! empty( $billing_address_prefix ) ) {
$billing_address = $billing_address_prefix . '<hr>' . $billing_address;
}
}
return $billing_address;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment