# before_invoicetemplate modifier

Invoice is about to be rendered (in html/pdf form).

TIP

$details is passed as reference (opens new window) so its possible to modify its value(s) in Advanced hook

You can modify contents of array passed and/or add new keys to array, allowing you to later reference the in invoice template. I.e.: by adding $details['yourvalue']='value'; would later allow you to access your data in invoice template through: {$invoice.yourvalue}.

# Hook parameter

An array is passed to hook containing following keys/values:

Key Type Description
id int Invoice ID
status string Current invoice status
client_id int Owner of invoice
date string Invoice generation date
subtotal float Subtotal
credit float Credit applied to invoice
tax float Tax applied to invoice
total float Invoice total
payment_module int ID of gateway used with invoice
currency_id int ID of invoice currency, default =0
notes string Invoice notes
items array Invoice items

The items array contains invoice items that are listed under this key, sample item:

Key Type Description
type string Item type (ie. Hosting, Domain)
item_id int Item id, for type=Hosting this relates to hb_accounts.id field
description string Item line text
amount float Item price
taxed int Is item taxed? 1/0
qty int Item quantitiy

# Sample hook files

Last Updated: 1/26/2024, 3:17:40 PM