Use Case: Invoice with Conditional Pricing
This example shows several levels of conditional logic working together. It is a common pattern for invoices, quotes, and order confirmations, where different customers should see different content on the same underlying template.
{{#if customer.isPremium}}
PREMIUM CUSTOMER INVOICE
========================
{{/if}}
Invoice for: {{customer.name}}
{{customer.address}}
{{#if customer.isPremium}}
Account Manager: {{customer.accountManager}}
{{#else}}
Standard Processing
{{/if}}
| Item | Quantity | Price | Total |
| {{items.name}} | {{items.quantity}} | {{items.price}} | {{items.total}} |
{{customer.isPremium ? "Premium Discount Applied: 10% off" : "Standard Pricing"}}
Total: ${{invoice.total}}
{{#if invoice.total > 1000}}
Thank you for your large order! Free shipping has been applied.
{{/if}}
Here is what each part is doing:
- The "PREMIUM CUSTOMER INVOICE" banner only prints for premium customers.
This is the same whole-section technique described in
Conditional Logic.
Wrapping a heading in
{{#if}}works exactly the same way as wrapping a whole table. - The account manager line is swapped out for a generic "Standard Processing" line depending on the customer's tier, using if / else.
- The line items table is built automatically: Formaliq creates one row for every item submitted on the form, using repeating rows. Every submitted item gets a row, there's currently no way to leave out just one item from the list while keeping the rest (see the caution note on the Conditional Logic page), so if you need to exclude an item, leave it off the submission rather than trying to hide its row afterward.
- The discount line and the free shipping note are each a single line that either appears or does not, rather than a full paragraph.
See Conditional Logic for the full explanation of every technique used here.