Last active
February 14, 2023 17:46
-
-
Save mircobabini/d783b0bd147e5cc82f46eb7dd4bfc7ae to your computer and use it in GitHub Desktop.
In order to use the "additional" fields feature, the premium version of the plugin is required. Check the simple version otherwise: https://gist.github.com/mircobabini/64ead066b22575f6948d133c82500555
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wpo_wcpdf_billing_address', function ( $billing_address, $invoice ) { | |
if ( ! empty( $invoice ) ) { | |
$customer_type = $invoice->order->get_meta( '_additional_wooccm0', true, 'view' ); | |
if ( 'Azienda' === $customer_type ) { | |
$company_name = $invoice->order->get_meta( '_additional_wooccm1', true, 'view' ); | |
$company_vat = $invoice->order->get_meta( '_additional_wooccm2', true, 'view' ); | |
$billing_address_prefix = ""; | |
$billing_address_prefix .= "<b>$company_name</b><br>"; | |
$billing_address_prefix .= "<b>PIVA: $company_vat</b><br><hr>"; | |
$billing_address = $billing_address_prefix . $billing_address; | |
} | |
// $billing_address .= ' //'; | |
// $billing_address .= $order->get_field( 'billing_first_name'); | |
} | |
return $billing_address; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment