WooCommerce Integration
Coming SoonWordPress plugin for XRechnung and ZUGFeRD. Open source and fully customizable for your WooCommerce store.
WordPress Plugin in Development
Our official WooCommerce Plugin is currently in development. In the meantime, you can integrate Invoice-api.xhub via WooCommerce Webhooks or custom PHP Hooks.
Features
WordPress Plugin
Easy installation via the WordPress plugin directory
WooCommerce Hooks
Seamless integration with all WooCommerce events
Open Source
Plugin code available on GitHub for customization
HPOS Compatible
Supports High-Performance Order Storage
PHP Hook Integration
Available WooCommerce Hooks
Use WooCommerce action hooks to automatically create e-invoices for orders.
woocommerce_order_status_completedOrder completed
woocommerce_payment_completePayment received
woocommerce_new_orderNew order created
woocommerce_checkout_order_processedCheckout completed
1// WooCommerce Hook für E-Rechnung2add_action('woocommerce_order_status_completed', 'create_einvoice', 10, 1);3 4function create_einvoice($order_id) {5 $order = wc_get_order($order_id);6 7 // Nur für B2B mit USt-ID8 $vat_id = $order->get_meta('_billing_vat_id');9 if (empty($vat_id)) return;10 11 $invoice_data = [12 'type' => 'xrechnung-3.0',13 'seller' => [14 'name' => get_option('woocommerce_store_name'),15 'vatId' => get_option('xhub_seller_vat_id'),16 'address' => [17 'street' => WC()->countries->get_base_address(),18 'city' => WC()->countries->get_base_city(),19 'zip' => WC()->countries->get_base_postcode(),20 'country' => WC()->countries->get_base_country()21 ]22 ],23 'buyer' => [24 'name' => $order->get_billing_company(),25 'vatId' => $vat_id,26 'address' => [27 'street' => $order->get_billing_address_1(),28 'city' => $order->get_billing_city(),29 'zip' => $order->get_billing_postcode(),30 'country' => $order->get_billing_country()31 ]32 ],33 'items' => array_map(function($item) {34 return [35 'description' => $item->get_name(),36 'quantity' => $item->get_quantity(),37 'unitPrice' => $item->get_total() / $item->get_quantity(),38 'vat' => 1939 ];40 }, $order->get_items()),41 'reference' => $order->get_order_number()42 ];43 44 // API Call zu Invoice-api.xhub45 wp_remote_post('https://service.invoice-api.xhub.io/api/v1/invoice/de/xrechnung/generate', [46 'headers' => [47 'Authorization' => 'Bearer ' . get_option('xhub_api_key'),48 'Content-Type' => 'application/json'49 ],50 'body' => json_encode($invoice_data)51 ]);52}Webhook Integration
Alternatively, you can use WooCommerce Webhooks and connect with an automation platform like n8n or Make.com.
- 1
Create WooCommerce Webhook
WooCommerce → Settings → Advanced → Webhooks
- 2
Create n8n/Make Workflow
Receive webhook and transform data
- 3
Call Invoice-api.xhub API
Create e-invoice and return to WooCommerce
1// Alternative: WooCommerce Webhooks2// Einstellungen → WooCommerce → Erweitert → Webhooks3 4// Webhook erstellen:5// - Name: "E-Rechnung bei Zahlung"6// - Status: Aktiv7// - Thema: "Bestellung aktualisiert"8// - Lieferungs-URL: https://your-n8n.com/webhook/woo-invoice9 10// Payload enthält komplette Bestelldaten:11{12 "id": 12345,13 "status": "completed",14 "billing": {15 "company": "Musterfirma GmbH",16 "address_1": "Musterstraße 123",17 "city": "Berlin",18 "postcode": "10115",19 "country": "DE"20 },21 "meta_data": [22 { "key": "_billing_vat_id", "value": "DE123456789" }23 ],24 "line_items": [...]25}Use Cases
B2B Shop
Automatic XRechnung for business customers with VAT ID
- 1Add VAT ID field to checkout
- 2Hook on payment receipt
- 3Create XRechnung via Invoice-api.xhub
- 4Attach PDF to order confirmation
Wholesale
ZUGFeRD invoices for resellers
- 1Wholesale plugin detects B2B customers
- 2Automatic ZUGFeRD EXTENDED
- 3Shipping with delivery note
- 4GoBD-compliant archiving
Multivendor
E-invoices for marketplace vendors
- 1Dokan/WCFM vendor detected
- 2Separate invoice per vendor
- 3XRechnung with vendor data
- 4Automatic commission billing