The invoice items object contains information about items on an invoice.
When printed, an items list will consist of a group, the items inside the group, and then a subtotal row.
A group from the default invoice/credit note document.
To build this in Liquid, you'd use a similar structure:
{% for item in invoice.items %}
{% if item.is_group? %}
{{ item.name }} <!-- Group name -->
{% elsif item.is_item? %}
{{ item.name }} <!-- Item name -->
{% elsif item.is_subtotal? %}
{{ item.subtotal_name }} <!-- Subtotal name, i.e. group name -->
{% endif %}
{% endfor %}
There's no subtotal row in the web interface. Subtotal items are included in the invoice items object to make it easy to include and style a subtotal row. A subtotal item iterates after a group and its items have iterated. They're purely informational rows, so most of the objects below will return "Liquid error" when used with a subtotal item.
The items list from the example above in the web interface.
Invoice items may depend slightly differently depending on how an invoice was generated. An invoice can be created manually, from an opportunity, or from a project.
When created from an opportunity or project, you can choose to itemize, or create summed lines for opportunity groups, product groups, or opportunities. Keep this in mind when building custom documents: some objects might make sense when itemized, but not when grouped by opportunity.
Invoice item objects are always accessed within a forloop that iterates for each item.
Document layouts
The item object can be accessed in document layouts created against the following modules:
Invoice
Opportunity
Returns invoice items for invoices linked to a particular opportunity.
Member
Returns invoice items for invoices linked to a particular organization.
Returns invoice items for active invoices linked to a particular organization.
Discussion templates
The item object can be accessed in discussion templates created against the following modules:
Invoice
Opportunity
Returns invoice items for invoices linked to a particular opportunity
Organization
Returns invoice taxes for invoices linked to a particular organization.
Returns invoice items for active invoices linked to a particular organization.
accessory_is_default?
Returns true if an invoice item is an accessory and the accessory’s inclusion type is “Default”.
Input
Output
accessory_is_mandatory?
Returns true if an invoice item is an accessory and the accessory’s inclusion type is “Mandatory”.
Input
Output
accessory_is_optional?
Returns true if an invoice item is an accessory and the accessory’s inclusion type is “Optional”.
Input
Output
accessory_mode_is_accessory?
Returns true if an invoice item is an accessory and the accessory’s mode is “Accessory”.
Input
Output
accessory_mode_is_component?
Returns true if an invoice item is an accessory and the accessory’s mode is “Component”.
Input
Output
accessory_mode_is_safety?
Returns true if an invoice item is an accessory and the accessory’s mode is “Safety”.
Input
Output
accessory_mode_name
Returns the accessory’s mode name where an invoice item is an accessory; blank otherwise.
accessory
component
safety item
Input
Output
charge_ends_at
Returns the charging end date for an invoice item. Generally used for invoice items with transaction types of rental or service.
Input
Output
charge_excluding_tax_total
Returns an invoice item charge total excluding tax.
When an item is an item, this will return accessories .
When the item is a group, this will return items within that group.
The children object only returns objects that are the next level deep in the tree. For example, accessories on accessories aren't returned.
Input
Output
depth
Returns the depth of an item in the tree. An item’s depth is determined by how it is nested under items.
In the example above, we can see invoice items with depths 1 to 4.
Input
Output
depth_padding
Returns the depth padding for an invoice item. Generally used to apply an inline style to a table cell in HTML so that items appear nested.
Increments in multiples of 16.
Input
Output
description
Returns an invoice item’s description.
Input
Output
discount_amount
Returns the amount of discount applied to an invoice item.
Returns 0.0 for groups and subtotals.
Input
Output
discount_percent
Returns the percentage discount applied to an invoice item.
Returns 0.0 for groups and subtotals.
Input
Output
discounted_price
Returns an invoice item’s price after discount.
Input
Output
has_child_items?
Returns true if an invoice item has children items; false otherwise. Generally used for detecting if an invoice item has accessories.
Input
Output
has_discount?
Returns true if an invoice item has a discount applied; false otherwise.
Where an invoice item has a negative discount applied, has_discount will return false. For example, -50% would increment the charge total by 50% so has_discount will return false.
Input
Output
id
Returns an invoice item ID.
The ID is an internal reference for a record. It's not exposed in our web interface.
Input
Output
invoiceable_item_description
Returns the description of the record that this invoice item is linked to.
When invoicing by item, this will return the description set against the product or service records.
When invoicing by product group, this will return the product group description set in System Setup > Product Groups.
When invoicing by opportunity, this will return the (internal) description set against the opportunity.
Returns blank for part invoice line items.
Input
Output
invoiceable_name
Input
Returns the name of the record that this invoice item is linked to.
When invoicing by item, this will return the name of the product or service.
When invoicing by product group, this will return the product group name set in System Setup > Product Groups.
When invoicing by opportunity, this will return the name set against the opportunity.
The invoiceable_name should generally be the same as the item name; it may be different if you’ve changed the name of a record after it’s been added to an invoice.
For part invoice line items, returns the value of the “Final Invoice Credit Text” in System Preferences. This is used when your final invoice is created at a later point.
Returns true if an invoice item is a group; false otherwise.
Input
Output
is_in_deal?
Returns true if an invoice item is inside a deal, i.e. if it is an informational line included underneath a deal price line on an invoice; false otherwise.
An item that is_in_deal? will always be nested under an item that is_deal_item?.
The price unit name output depends on the rental charge used. Some common examples:
Daily
Weekly
Per period
Each
Input
Output
project_name
Returns the name of the project that an invoice item is related to. Generally the name of the project linked to the opportunity that was the origin of an invoice item.
Input
Output
quantity
Returns the quantity of an invoice item.
Input
Output
rate_definition_name
Returns the rate definition name for an invoice item where the item is a rental.
Returns blank for sales, services, surcharges, and group items.
Input
Output
service_unit_name
Returns the service unit name for an invoice item.
Day
Days
Hour
Hours
miles
km
Input
Output
source_name
Returns the name of the source of an invoice item. Generally the name of the opportunity that was the origin of an invoice item.
Input
Output
subtotal
Returns the subtotal amount for an invoice item group.
Subtotal rows are informational only. This will only return a value for subtotal rows. This will match the charge_total of the corresponding invoice item group.
Input
Output
subtotal_name
Returns the subtotal name for an invoice item group.
Subtotal rows are informational only. This will only return a value for subtotal rows. This will match the name of the corresponding invoice item group.
Input
Output
tax_class_name
Returns the tax class name against an invoice item. This is set against the product or service record, or when creating a text item.
Input
Output
tax_total
Returns the tax total for an invoice item.
Input
Output
transaction_type_name
Returns the transaction type name for an invoice item.
Rental
Sale
Service
Input
Output
unit_charge
Returns the unit charge for an invoice item.
The unit charge is the price for one unit of an invoice item.
Input
Output
unit_charge_amount
Returns the unit charge for an invoice item excluding discount.
The unit charge is the price for one unit of an invoice item.
Input
Output
use_chargeable_days
Returns true if an invoice item has overriden chargeable days.
This will be the case where the source opportunity of an invoice has the "Chargeable Days" toggle set to YES.