# Template objects

URL: https://docs.sparklayer.io/developers/templates/template-objects

Properties of the objects available in SparkLayer Liquid templates, including Merchant, Purchase, LineItem, Customer, Address, Money and invoice content zones.

These are the SparkLayer objects you can use in [templates](https://docs.sparklayer.io/developers/templates.md) and invoice content zones. Which objects are available depends on the template: check the template's documentation to see what it receives.

Nested properties are shown with dot notation (for example `dates.created_at`), and `[]` marks an array item.

## Address

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `name` | `string` | The addressee's name | _-_ |
| `company` | `string` | The company name | _-_ |
| `address_line1` | `string` | Line 1 of the address | _-_ |
| `address_line2` | `string,null` | Line 2 of the address | _-_ |
| `city` | `string` | The city | _-_ |
| `region_code` | `string,null` | The region code, such as a state or county code | _-_ |
| `postal_code` | `string,null` | The postal code or postcode | _-_ |
| `country_code` | `string` | The country code. Use the [`country` filter](https://docs.sparklayer.io/developers/templates.md#country-from-country-code) to show the country name | _-_ |
| `phone` | `string,null` | The phone number | _-_ |

## Customer

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `id` | `string` | The customer's SparkLayer ID | _-_ |
| `title` | `string` | The customer's title | _-_ |
| `first_name` | `string` | The customer's first name | _-_ |
| `last_name` | `string` | The customer's last name | _-_ |
| `email` | `string` | The customer's email address | _-_ |
| `company_name` | `string,null` | The customer's company name | _-_ |
| `external_id` | `string` | - | _-_ |
| `accounting_id` | `string` | - | _-_ |

## ContentZone

Content zones are configured as part of the invoicing feature. They can contain Liquid variables, so handle them accordingly in your templates.

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `title` | `string,null` | The content zone's title | _-_ |
| `content` | `string,null` | The content zone's content, which can contain Liquid variables | _-_ |

## InvoiceSettings

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `content_zones.zone_1` | [ContentZone](#contentzone) | Invoice content zone 1 | _-_ |
| `content_zones.zone_2` | [ContentZone](#contentzone) | Invoice content zone 2 | _-_ |
| `content_zones.zone_3` | [ContentZone](#contentzone) | Invoice content zone 3 | _-_ |

## LineItem

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `custom_attributes.[].key` | `string` | A custom attribute's key | _-_ |
| `custom_attributes.[].value` | `string` | A custom attribute's value | _-_ |
| `identifiers.sku` | `string,null` | The product's SKU | _-_ |
| `name_child` | `string,null` | - | _-_ |
| `name_parent` | `string` | - | _-_ |
| `quantity` | `integer` | The quantity ordered | _-_ |
| `line_total` | [LineTotal](#linetotal) or `null` | The totals for the whole line | _-_ |
| `unit_total` | [UnitTotal](#unittotal) or `null` | The totals for one unit | _-_ |
| `image_url` | `string,null` | The URL of the product's image | _-_ |
| `product_slug` | `string,null` | - | _-_ |
| `rrp` | [Money](#money) or `null` | The recommended retail price (RRP) | _-_ |
| `barcode` | `string,null` | The product's barcode | _-_ |

## LineTotal

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `total_net` | [Money](#money) | The line total, excluding tax | _-_ |
| `discount_net` | [Money](#money) | The discount on the line, excluding tax | _-_ |
| `tax_rate` | `number` | The tax rate applied to the line | _-_ |

## Merchant

The merchant's store details.

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `address1` | `string,null` | Line 1 of the merchant's store address | _-_ |
| `address2` | `string,null` | Line 2 of the merchant's store address | _-_ |
| `base_currency` | `string,null` | The base currency used by the store | _USD,GBP_ |
| `city` | `string,null` | City of the merchant's store address | _-_ |
| `region` | `string,null` | Region code of the merchant's store address | _-_ |
| `country` | `string,null` | Country code of the merchant's store address | _GB_ |
| `email` | `string,null` | The merchant's email address | _-_ |
| `phone` | `string,null` | The merchant's store phone number | _-_ |
| `postcode` | `string,null` | Postcode of the merchant's store address | _-_ |
| `store_name` | `string,null` | The connected platform's store name | _-_ |
| `timezone` | `string,null` | The store's time zone | _-_ |
| `url` | `string,null` | The store's URL | _-_ |
| `locale` | `string,null` | The default locale of the store | _en,fr_ |

## Money

A monetary value.

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `amount` | `string` | The amount | _-_ |
| `currency` | `string` | The currency code | _GBP,USD_ |

## Package

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `line_items` | `array of` [LineItem](#lineitem) | The line items in the package | _-_ |
| `shipping_address` | [Address](#address) | The address the package is shipped to | _-_ |

## Purchase

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `currency_code` | `string` | The purchase's currency code | _-_ |
| `billing_address` | [Address](#address) | The billing address | _-_ |
| `customers.sparklayer` | [Customer](#customer) | The SparkLayer customer who placed the purchase | _-_ |
| `custom_fields.[].name` | `string` | A custom field's name | _-_ |
| `custom_fields.[].value` | `string,null` | A custom field's value | _-_ |
| `customer_reference` | `string,null` | The customer's own reference for the purchase | _-_ |
| `dates.created_at` | `string` | When the purchase was created | _-_ |
| `dates.updated_at` | `string` | When the purchase was last updated | _-_ |
| `dates.placed_at` | `string,null` | When the purchase was placed | _-_ |
| `dates.calculated_submitted_at` | `string,null` | - | _-_ |
| `identifiers.visible` | `string` | The purchase ID shown to customers | _-_ |
| `packages` | `array of` [Package](#package) | The purchase's packages, each with its line items and shipping address | _-_ |
| `line_items` | `array of` [LineItem](#lineitem) | The purchase's line items | _-_ |
| `subtotal` | [Money](#money) | The subtotal | _-_ |
| `tax` | [Money](#money) | The total tax | _-_ |
| `shipping_cost` | [Money](#money) | The shipping cost | _-_ |
| `calculated_total` | [Money](#money) | The calculated total | _-_ |
| `tax_lines` | `array of` [TaxLine](#taxline) | The tax lines that make up the total tax | _-_ |

## UnitTotal

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `total_net` | [Money](#money) | The unit price, excluding tax | _-_ |
| `total_gross` | [Money](#money) | The unit price, including tax | _-_ |
| `total_tax` | [Money](#money) | The tax on one unit | _-_ |
| `tax_rate` | `number` | The tax rate applied | _-_ |

## TaxLine

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `title` | `string` | The tax line's name | _-_ |
| `rate` | `number` | The tax rate | _-_ |
| `amount.number` | `string` | The tax amount | _-_ |
| `amount.currency` | `string` | The tax amount's currency code | _-_ |

## PurchaseHistoryMessage

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `body` | `string` | The message's text | _-_ |
| `created_at` | `string` | When the message was sent | _-_ |
| `customer` | [Customer](#customer) | The customer who sent the message | _-_ |

## AssignmentDetails

### Properties

| Key | Type | Description | Example(s) |
| --- | --- | --- | --- |
| `assigned_by` | [Customer](#customer) | Who assigned the quote | _-_ |
| `assigned_on` | `string` | When the quote was assigned | _-_ |

If a property doesn't behave as described here, [contact our support team](https://docs.sparklayer.io/help/support.md).

## Next steps

- [Templates](https://docs.sparklayer.io/developers/templates.md): the templates you can customise and the filters they can use.
- [Invoices](https://docs.sparklayer.io/help/ordering/invoices.md): the invoice PDF and its settings.
