I'm running a site that sells both B2C and B2B. In Germany, when selling B2B, the store owner does not charge VAT, however, the buyer needs to pay VAT - see https://www.german-tax-consultants.com/vat-services/german-vat-reverse-charge.html .
I have added a VAT field as a custom billing address field using the woocommerce_admin_billing_fields field:
add_filter( 'woocommerce_admin_billing_fields',
function ( $billing_fields ) {
$billing_fields['vat'] = array( 'label' => __( 'VAT', 'woocommerce' ) );
$order = array(
"first_name",
"last_name",
"company",
"vat",
"country",
"address_1",
"address_2",
"city",
"state",
"postcode",
);
$ordered_fields = array();
foreach ( $order as $field ) {
$ordered_fields[ $field ] = $billing_fields[ $field ];
}
$billing_fields = $ordered_fields;
return $billing_fields;
} );
I'm specifically NOT using the EU VAT Number extension (yes, I've tried) because 1. it is not possible to inject the value of that field in the billing address and 2. it's not possible to put the value into the PDF invoice.
When the country is "Germany" and the "company name" and "vat" fields are set, I need to
- Remove the tax from the total using the "woocommerce_cart_calculate_fees" action.
- Add text after the "totals" block.
- Add the text from #2 to the PDF invoice
So here are my questions:
- How can I trigger the "woocommerce_order_details_after_order_table" hook when the above conditions are satisfied?
- Add the text to the PDF invoice?