woocommerce eu vat number registration form code example

Example: send invoices with vat number woocommmerce

/**
 * Add PDF invoice information meta (from third party plugins).
 *
 * @param array         $info Invoice info meta.
 * @param BEWPI_Invoice $invoice Invoice object.
 * @since 2.9.8
 *
 * @return array.
 */
function add_invoice_information_meta( $info, $invoice ) {
    // Add VAT Number from 'WooCommerce EU VAT Number' plugin.
    $vat_number = WPI()->get_meta( $invoice->order, '_vat_number' );
    if ( $vat_number ) {
        $info['vat_number'] = array(
            'title' => __( 'VAT Number:', 'woocommerce-pdf-invoices' ),
            'value' => $vat_number,
        );
    }

    return $info;
}
add_filter( 'wpi_invoice_information_meta', 'add_invoice_information_meta', 10, 2 );

Tags:

Misc Example