Buy B2BKing
$299 $199
For fields to appear on invoices, they first need to be added to billing. To do this, go to B2BKing -> Registration Fields, click on the field(s) you need, and enable the 'Add custom field to billing' checkbox.
Example
We have created two B2BKing custom fields and enabled the "Add custom field to billing" option. The fields are "New Test Field" and "VAT Number." As you can see, these fields now appear on the checkout page as billing fields:
Once fields have been added to billing, most invoice plugins will automatically display them on their invoices.
We recommend using the WooCommerce PDF Invoices & Packing Slips by WP Overnight plugin. The free version is sufficient.
After placing an order, we can see that the fields from our previous screenshots have been added to the PDF invoice:
If you would like to do custom work and display fields in a more specific or unique manner, there are multiple ways to add custom fields:
You can read more about invoice customization options with this invoice plugin here.
You can also find a list of plugin hooks for the invoice plugin here.
Note: Generally, other invoice plugins should work as well, although the plugin we recommend above is the most popular option.
If your shop uses Germanized for invoice generation, their plugin will not include custom B2BKing fields by default — such fields have to be added through a code snippet.
To add the VAT number to Germanized invoices, add the following PHP code snippet to your site:
add_filter('storeabill_invoice_get_formatted_address', function($address, $document){ $order_id = $document->get_order_id(); $order = wc_get_order($order_id); if ($order){ $vat_number = $order->get_meta('vat_number'); $address .= '<br>'.$vat_number; } return $address; }, 10, 2);
To add other fields, replace $order->get_meta('vat_number'); with $order->get_meta('b2bking_custom_field_1234');, where 1234 is the field ID of your custom field. You can find the field ID in the URL when you edit that field in the backend (e.g., if you see ?post=456 in the URL, then 456 is the ID).
This should add the VAT number or custom field after the billing address, as shown here:
Powered by BetterDocs