=== Rechnungerei E-Rechnung – XRechnung & ZUGFeRD for WooCommerce ===
Contributors: bratools
Tags: e-invoice, xrechnung, zugferd, woocommerce, invoice
Requires at least: 6.4
Tested up to: 7.1
Requires PHP: 7.4
Requires Plugins: woocommerce
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Free German e-invoices (E-Rechnung: XRechnung 3.0 / ZUGFeRD) for WooCommerce orders, validated against EN 16931 and the official KoSIT rules.

== Description ==

**Free e-invoices for WooCommerce – no subscription, no pro version.**

From 1 January 2027, companies in Germany with more than EUR 800,000 turnover in the previous year must send invoices to other businesses (domestic B2B) as e-invoices ("E-Rechnung"). From 1 January 2028 this applies to all companies. All companies must already be able to receive e-invoices since 1 January 2025. A normal PDF invoice is not an e-invoice.

This plugin turns your WooCommerce orders into real e-invoices:

* **ZUGFeRD PDF with XRechnung 3.0 inside** (readable for humans and machines, PDF/A-3) – recommended
* **ZUGFeRD PDF, profile EN 16931**
* **XRechnung 3.0 as plain XML** (e.g. for public authorities with a Leitweg-ID)

Every invoice is validated against **EN 16931** and the **XRechnung schematron of the KoSIT** before it is saved. Invalid invoices are never delivered – instead you see a clear error message (in German) in the order.

= Features =

* Created automatically when an order is "Completed" or "Processing" – or only manually with a button in the order
* Only for business customers (company name or VAT ID given) or for all orders
* Sequential invoice numbers with your own prefix (e.g. `RE-{Y}-0001`), incremented atomically, never duplicated
* Items with quantity, net unit price and VAT rate (19 %, 7 %, 0 %) taken directly from WooCommerce
* Shipping, fees and coupons/discounts are transferred correctly
* Orders that are already paid (PayPal, card …) are shown as paid
* Small business mode (Kleinunternehmer, § 19 UStG) with the required note
* Tax-free items: export, intra-community supply, reverse charge or your own exemption reason
* Optional checkout field "Buyer reference / Leitweg-ID" (classic and block checkout)
* Customer VAT ID from common EU VAT plugins or entered manually in the order
* Your own logo and accent colour on the PDF
* Attached to the customer e-mail "Order completed"
* Download in My account → Orders and in the admin order list
* Protected storage in `wp-content/uploads/rechnungerei-e-rechnung/` (no direct access, random file names)
* Compatible with High-Performance Order Storage (HPOS)
* Complete German translation included

Only orders in EUR are supported. This plugin is not tax advice.

== External services ==

This plugin connects to the external service **rechnungerei.de** to create the e-invoice files. Without this service the plugin cannot create invoices.

* **When data is sent:** only after the shop owner has given consent in WooCommerce → Settings → E-Rechnung, and only when an e-invoice is created (automatically at the chosen order status or manually with the button). The plugin then sends one POST request to `https://rechnungerei.de/api/create`.
* **What is sent:** the invoice data of that order – the seller data from the settings (company name, contact person, address, e-mail, phone, VAT ID/tax number, IBAN/BIC, optional logo and colour), the customer's billing name, company, address, e-mail, phone and VAT ID, the buyer reference, the order number, items, quantities, prices, taxes, shipping, discounts and the payment status.
* **What is returned:** the finished PDF or XML file, or a list of validation errors.
* **No tracking:** the plugin loads no remote scripts, fonts or images and sends no other data.
* Service provider: rechnungerei.de – Privacy policy: https://rechnungerei.de/datenschutz/

Shop owners should mention this data transfer in their own privacy policy.

== Installation ==

1. Install and activate the plugin (WooCommerce must be active).
2. Go to WooCommerce → Settings → **E-Rechnung**.
3. Give consent to send order data to rechnungerei.de.
4. Enter your company data (name, address, e-mail, phone, VAT ID or tax number, IBAN).
5. Choose when invoices are created – done.

== Frequently Asked Questions ==

= Is the plugin really free? =

Yes. There is no pro version, no subscription and no limit in the plugin. The invoices are created by the free service rechnungerei.de. Please respect the fair-use limit of the service (about 20 invoices per minute).

= Does my online shop need e-invoices? =

Not for consumers (B2C) – they may still receive PDF or paper invoices. For invoices to businesses in Germany (domestic B2B) the obligation to send e-invoices starts in 2027 (previous-year turnover above EUR 800,000) or 2028 (all companies). Small-amount invoices up to EUR 250 gross are exempt. That is why the plugin creates e-invoices for business customers only by default.

= What is the difference between XRechnung and ZUGFeRD? =

XRechnung is a pure XML format (standard of the KoSIT, required by many public authorities). ZUGFeRD is a PDF/A-3 with embedded XML – people see a normal invoice, software reads the data. By default the plugin embeds an XRechnung 3.0 in the ZUGFeRD PDF, so both are covered.

= I am a small business (Kleinunternehmer). Does it work for me? =

Yes. Enable "Small business (§ 19 UStG)". The invoice then contains no VAT and the note "Gemäß § 19 UStG wird keine Umsatzsteuer berechnet." Small businesses are exempt from the obligation to send e-invoices, but many customers ask for them anyway.

= Is my data stored? =

The order data is sent to rechnungerei.de to create the invoice. According to the operator it is only processed to create and validate the invoice and is not stored. The finished file is stored only in your WordPress. Details: https://rechnungerei.de/datenschutz/

= How are coupons shown? =

Items are listed with their regular price; the coupon discount follows as a separate deduction line (quantity −1) for each VAT rate. This keeps net and tax amounts per VAT rate correct.

= The invoice total differs by 1 cent – why? =

By default WooCommerce rounds tax per item, while an e-invoice calculates tax per VAT rate on the total. This can lead to a difference of 1 cent; the order then shows a note. With WooCommerce → Settings → Tax → "Round tax at subtotal level" both usually match exactly.

= Where are the files stored? Do I have to archive them? =

In `wp-content/uploads/rechnungerei-e-rechnung/`, protected against direct access by .htaccess and random file names. Invoices must be archived unchanged for 8 years in Germany (GoBD) – please also keep a copy in your accounting system or archive. The files stay in place when the plugin is deleted. On nginx servers (no .htaccess) the random file names protect the files; ideally also block the folder in your server configuration.

= Can invoice numbers be duplicated? =

No. The number is incremented atomically in the database and assigned once per order. If an invoice is created again, it keeps its number.

= Which currencies are supported? =

Currently only EUR.

= Does the plugin create credit notes / cancellation invoices? =

Not yet. For refunds please ask your accountant.

== Screenshots ==

1. Settings in WooCommerce → Settings → E-Rechnung
2. "E-Rechnung" box in the order: create, download, see errors
3. Created ZUGFeRD PDF with embedded XRechnung 3.0
4. "E-invoice" column in the order list

== Changelog ==

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 1.0.0 =
First release.
