AI-generated WordPress plugin

Generate a WooCommerce automatic PDF invoice plugin

Every shop eventually needs invoices attached to order confirmation emails. The popular plugins do this well for generic cases but tend to be opinionated about layout, field names and where files are stored. Spanish shops need the FA-YY-NNNNNN numbering and the EU VAT reverse-charge clause. German shops need sequential invoice numbering across the calendar year. UK shops that are VAT-registered need MTD-compatible VAT fields. "Opinionated" becomes "wrong" as soon as you cross a border.

Generating this plugin from scratch gives you a template that matches your actual paperwork. We use a PDF engine that runs server-side (dompdf or mPDF), store invoices with cache headers and a signed-URL download, and let you edit the template file directly when the accountant decides next year that the logo needs to be 2mm smaller.

5 min to ZIP 24 h live sandbox WP Coding Standards

Why generate it instead of installing an existing plugin?

WooCommerce PDF Invoices & Packing Slips (by WP Overnight) is the most popular free option. For a vanilla EU shop it is perfectly adequate. You start hitting walls when you need bilingual invoices, specific numbering per series (shop vs services), QR codes for Spanish Verifactu, or when you want invoices stored outside the default /uploads path.

The premium addons stack quickly — Pro bundle is around €109/year, with extra per-feature addons for things like Dropbox upload. For a shop that generates 500 invoices a month, a plugin that exactly matches your fiscal requirements and stores in your own DO Spaces / S3 is a one-time generation rather than a recurring bill.

The biggest hidden cost of generic invoice plugins is PDF storage growth. Invoices accumulate in /wp-content/uploads/ indefinitely and nobody cleans them. A generated plugin can be built with DO Spaces / S3 integration from day one, keeping your server footprint flat.

Example prompt

This is the kind of description that generates this plugin. You can start from it and tweak whatever you need before hitting generate.

Plugin name: Acme WC Invoices (Spain SII-ready)

Invoice generation trigger: woocommerce_order_status_completed.

Number format: FA-2-YY-NNNNNN, atomic via a sequence table.

Layout (A4, portrait):
- Header: our logo (from settings), our legal name + CIF + address.
- Customer block: name, CIF/NIE, billing address.
- Line items table: SKU, name, quantity, net unit price, VAT rate, line total.
- Totals block: net, VAT by rate, grand total.
- Footer: legal clause (editable in settings), sequential number, page x of y.

Generated PDF attached to the order confirmation email automatically.

Storage: /wp-content/uploads/acme-invoices/YYYY/MM/<code>.pdf locally, AND optional sync to DO Spaces with a setting for key + secret + bucket.

Admin: list of invoices with status, re-download, regenerate (keeps the same number).

Customer My Account tab "Invoices" showing a signed download link valid 1 hour.

HPOS-compatible. Uninstall leaves the PDFs on disk but removes the DB sequence and options.

What the generated plugin typically includes

  • dompdf or mPDF bundled in vendor/ with autoloader
  • Atomic invoice number allocation via a small custom table with row locking
  • HTML template under /templates/invoice.php, overridable by the active theme
  • Hook into woocommerce_email_attachments to attach on the right transactional email
  • Admin list table showing all generated invoices with bulk re-download
  • Settings page with issuer data, VAT rules, numbering format, storage destination
  • HPOS-compatible order reading throughout

Add Verifactu QR for Spanish electronic invoicing, custom numbering per language, rectification invoices (abono), EU OSS VAT handling — describe the accountant requirement and the plugin reflects it.

Frequently asked questions

Does it support Spanish Verifactu?

The plugin can generate the QR code and the hashed signature if you describe the requirement. Verifactu integration evolves fast — mention the specific AEAT version you are targeting and we write the exact algorithm.

Where are the PDFs stored?

By default in /uploads/ under a year/month hierarchy. You can point the plugin at a DO Spaces / S3 bucket and it writes there with signed-URL downloads for customers. Good for shops that generate hundreds per day.

Can I edit the invoice layout after generation?

Yes. The template file is plain PHP + HTML. Change the logo size, add a field, move the totals block — it takes a minute once you know the template. A "regenerate" button in the admin re-runs the PDF while keeping the invoice number.

Does it handle refunds?

On refund, the plugin creates a rectification invoice (series FR-YY-NNNNNN) referencing the original. Describe your fiscal requirements and it is implemented correctly the first time.

Ready to generate your plugin?

Create a free account, verify your email, first generation is on us.

Related:WooCommerceAccountingPDFHPOS-ready