commerce_invoice
Commerce Invoice is a module for Drupal Commerce that allows store owners to generate, customize, and manage PDF invoices for customer orders. It supports automatic invoice generation, PDF rendering via Entity Print, and flexible invoice numbering through configurable patterns.
Features
- Automatic invoice generation upon order placement.
- Manual invoice generation using the provided service.
- Support for multiple invoice types.
- PDF generation using the Entity Print module.
- Configurable invoice numbering using number patterns.
Installation
- Enable the module.
- Go to the desired Order Type edit form and enable invoicing for that order type.
- You can optionally enable automatic invoice generation so that invoices are created when orders are placed.
- Ensure your private file system path is correctly configured. See Drupal's documentation on private file systems.
Invoice Type Configuration
Commerce Invoice provides a "Default" invoice type and a "Credit memo" that can be customized at:
/admin/commerce/config/invoice-types
PDF Rendering with Entity Print
This module requires the Entity Print module to generate PDF versions of invoices.
Once Entity Print is installed, set the PDF engine to Php Wkhtmltopdf for best results.
For further details, please refer to Entity Print PDF Engine Support.
Invoice Number Customization
The invoice number format is managed using Commerce Number Patterns.
You can configure these patterns at:
/admin/commerce/config/number-patterns
By default, the included invoice type uses the "infinite" number generation strategy, but this can be adjusted as needed.
Manually Generating Invoices
Developers can generate invoices manually using the service provided by the module:
$invoice_generator = \Drupal::service('commerce_invoice.invoice_generator');
$invoice_generator->generate($orders, $store, $profile);