Documentation

How to create custom HTML templates of invoices?

This guide is intended for advanced users familiar with PHP and WordPress theme files.

Check how to customize invoice templates by using Advanced Templates for Flexible Invoices add-on.

Custom Invoice Templates in Your Theme#

You can customize classic PDF document templates by placing copies of their PHP files in the active theme's directory. The plugin loads matching files from the theme before using its own templates.

This method applies to classic PHP templates. If you use (Beta) Gutenberg Invoice Editor, edit the document layout in the block template editor instead.

Copy the Template Files#

  1. Locate the document templates in the Flexible Invoices plugin directory. For Flexible Invoices PRO, the source directory is:

    wp-content/plugins/flexible-invoices-woocommerce/vendor_prefixed/wpdesk/flexible-invoices-core/templates/documents/

    For the free plugin, the source directory is:

    wp-content/plugins/flexible-invoices/vendor_prefixed/wpdesk/flexible-invoices-core/templates/documents/

  2. Create a flexible-invoices directory inside your active theme. Use a child theme to preserve your customizations when updating the parent theme.

  3. Copy the documents folder into that directory, preserving its name and internal folder structure. The resulting path should be:

    wp-content/themes/YOUR-ACTIVE-THEME/flexible-invoices/documents/

    If a child theme is active, replace YOUR-ACTIVE-THEME with the child theme's directory name.

Edit and Check the Template#

Edit the copied PHP files to change text, layout or the information displayed on the document. Keep the original file names and relative paths so the plugin can locate your overrides.

For example, the classic default invoice layout can be overridden at:

wp-content/themes/YOUR-ACTIVE-THEME/flexible-invoices/documents/invoice/invoice-default.php

Modify the files used by your selected layout. You can keep only the files you need to override; files missing from the theme directory are loaded from the plugin.

Generate a PDF after making changes and check its content, totals and page layout. Test each document type and layout affected by your modifications.

Theme overrides are not replaced during plugin updates. After updating the plugin, compare your customized files with the current originals and apply any necessary compatibility changes.

Restore the Original Templates#

To stop using a particular override, remove or rename that file in the theme's flexible-invoices/documents/ directory.

To disable all document template overrides, rename or remove the copied documents folder. The plugin will use its original templates when generating PDFs again. Previously downloaded PDF files remain unchanged.

Not the solution you are looking for?

Please check other articles or open a support ticket.