Configuring invoices

Invoices (receipts) are commercial documents that you issue to the customers to indicate purchase-related details:

  • Products
  • Quantities
  • Prices
  • Other purchase-related details

The Kentico E-commerce Solution allows you to customize the invoice design. After configuring invoices, you can work with them while editing an order in the Orders application on the Invoice tab.

Editing an order - Invoice tab

Setting up the invoice number pattern

With the default invoice number pattern, the system displays the invoice number equal to the order number. If you want to change the format of the invoice number, change the corresponding setting:

  1. Open the Store configuration application (if you want to set up the invoice number pattern for the current site) or the Multistore configuration application (if you want to set up the invoice globally).

    If you are not sure what to choose, see Choosing site or global e-commerce configuration. If you are not sure about specifics of configuring in these applications, see Configuring e-commerce settings for a specific site or globally.

  2. In the Invoice number pattern field in the Invoice category, type the required pattern.

    You can use macros. For example, the default pattern is: {% Order.OrderID %}

    • If you are in the Store configuration application, clear the Inherit from global settings option first.
  3. Click Save.

The system generates new invoices with their numbers formatted according to the specified setting.

Setting up the appearance of invoices

You can configure the invoice template in the Store configuration application (if you want to set up the invoice for the current site) or in the Multistore configuration (if you want to set up the invoice globally) on the Invoice tab.

This configuration sets only the invoice which is displayed in the administration user interface and which you can print. If you want to send the invoice via email, configure the corresponding email notification.

The system allows you to further modify the invoice design by using special expressions, i.e. macros, to insert dynamic parts of the invoice. For example, you can use the {% Order.OrderInvoiceNumber %} expression to insert the invoice number.

Macro examples

The following table contains macro examples that you can use in the invoice template.

The macros always display values from the database table row, which belongs to the order or the order’s object.

Macro

Description and examples

Prices

{%Currency.<property>%}

Displays a value from a column in the currency database table (COM_Currency).

  • {%Currency.CurrencyCode%} – displays the currency’s code (e.g. USD)

{%GrandTotal%}

Displays the order’s final overall price.

{%TotalShipping%}

Displays the order’s shipping price.

  • {%TotalShipping.Format(Currency.CurrencyFormatString)%} – displays the total shipping of the order formatted as specified in the currency’s format string

{%TotalTax%}

Displays the total sum of all taxes that apply to the order.

{%TaxSummary.ApplyTransformation(<transformations>)%}

Displays a list of taxes (tax classes) that apply to the order (products and shipping). The appearance of the taxes is determined by the specified transformations.

For example, the following expression uses the default transformations to display a table of tax class names and values:

{% TaxSummary.ApplyTransformation(
“Ecommerce.Transformations.Order_TaxesTable”,
“Ecommerce.Transformations.Order_TaxesTableHeader”,
“Ecommerce.Transformations.Order_TaxesTableFooter”) %}

Order data

{%ContentTable.ApplyTransformation(<transformations>)%}

Displays a list of the ordered products using specified transformations.

For example, the following expression uses the default content table transformations:

{% ContentTable.ApplyTransformation(
“Ecommerce.Transformations.Order_ContentTable”,
“Ecommerce.Transformations.Order_ContentTableHeader”,
“Ecommerce.Transformations.Order_ContentTableFooter”) %}

{%Order.<property>%}

Displays a value from a column in the order database table (COM_Order).

  • {%Order.OrderInvoiceNumber%} – displays the invoice number
  • {%Order.OrderNote|(encode)%} – displays encoded order note
  • {%Order.OrderIsPaid%} – displays the paid status of the order
  • {%Format(Order.OrderDate, “{0:d}”)%} – displays the formatted order date

{%OrderStatus.<property>%}

Displays a value from a column in the order status database table (COM_OrderStatus).

  • {%OrderStatus.StatusDisplayName%} – displays the order status’s display name

{%ShippingOption.<property>%}

Displays a value from a column in the shipping option database table (COM_ShippingOption).

  • {%ShippingOption.ShippingOptionDisplayName%} – displays the shipping option’s display name

{%PaymentOption.<property>%}

Displays a value from a column in the payment method database table (COM_PaymentOption).

  • {%PaymentOption.PaymentOptionDisplayName%} – displays the payment method’s display name

{%ShoppingCart.<property>%}

Displays a value from a column in the shopping cart database table (COM_ShoppingCart). With the shopping cart, you can get to any other mentioned macro, for example:

  • {%ShoppingCart.ShoppingCartCurrency.CurrencyCode%} – displays the currency’s code (e.g. USD)

Order discounts and gift cards

{%OrderDiscount%}

Displays the total value of all applied order discounts.

  • {%OrderDiscount.Format(Currency.CurrencyFormatString)%} – displays the order discount total formatted according to the format string of the set currency

{%OrderDiscountSummary.ApplyTransformation(<transformations>)%}

Displays a summary of the order discounts applied to the order. The appearance of the order discounts is determined by the specified transformations.

For example, the following expression uses the default transformations to display a table of order discount names and values:

{% OrderDiscountSummary.ApplyTransformation(
“Ecommerce.Transformations.Order_OrderRelatedDiscountsContent”,
“Ecommerce.Transformations.Order_OrderRelatedDiscountsHeader”,
“Ecommerce.Transformations.Order_OrderRelatedDiscountsFooter”) %}

{%OtherPayments%}

Displays the total value of applied gift cards.

  • {%OtherPayments.Format(Currency.CurrencyFormatString)%} – displays the gift card total formatted according to the format string of the set currency

{%OtherPaymentsSummary.ApplyTransformation(<transformations>)%}

Displays a summary of the gift cards applied to the order. The appearance of the gift cards is determined by the specified transformations.

For example, the following expression uses the default transformations to display a table of gift card names and values:

{% OtherPaymentsSummary.ApplyTransformation(
“Ecommerce.Transformations.Order_OrderRelatedDiscountsContent”,
“Ecommerce.Transformations.Order_OrderRelatedDiscountsHeader”,
“Ecommerce.Transformations.Order_OrderRelatedDiscountsFooter”) %}

Customer data

{%Customer.<property>%}

Displays a value from a column in the customer database table (COM_Customer).

  • {%Customer.CustomerEmail%} – displays the customer’s email address
  • {%Customer.CustomerOrganizationID%} – displays the customer’s organization ID (for company accounts)
  • {%Customer.CustomerTaxRegistrationID%} – displays the customer’s tax registration ID (for company accounts)

{%BillingAddress.<property>%}

Displays a value from a column in the billing address database table (COM_OrderAddress).

  • {%BillingAddress.AddressLine1%} – displays the first line of the billing address

{%BillingAddress.Country.<property>%}

Displays a value from a column in the billing address country database table (CMS_Country).

  • {%BillingAddress.Country.CountryDisplayName%} – displays the billing address’s country display name

{%BillingAddress.State.<property>%}

Displays a value from a column in the billing address state database table (CMS_State).

  • {%BillingAddress.State.StateDisplayName%} – displays the billing address’s state display name

{%ShippingAddress.<property>%}

Displays a value from a column in the shipping address database table (COM_OrderAddress).

  • {%ShippingAddress.AddressLine1%} – displays the first line of the shipping address

{%ShippingAddress.ApplyTransformation(<transformation>)%}

Displays the formatted shipping address (COM_OrderAddress) using the specified transformation.

  • {%ShippingAddress.ApplyTransformation(“Ecommerce.Transformations.Order_Address”)%} – displays the shipping address using the default transformation for formatting addresses

{%ShippingAddress.Country.<property>%}

Displays a value from a column in the shipping address country database table (CMS_Country).

  • {%ShippingAddress.Country.CountryDisplayName%} – displays the shipping address’s country display name

{%ShippingAddress.State.<property>%}

Displays a value from a column in the shipping address state database table (CMS_State).

  • {%ShippingAddress.State.StateDisplayName%} – displays the shipping address’s state display name
Learn more about macros in Macro expressions.