Dynamic Text Operator Examples for SKUs
SKU description
You can configure the SKU and line item description to display dynamic values. Below are a few examples of how to use dynamic content in your SKU description.
Show a description based on the quantity of all SKUs
{{! Show me some text when any line item on my deal is more than 1000 quantity}}
{{#gte (length (filterBy (values deal.skus) "quantity" ">" "1000")) 1 }}
Show when quantity of deal is over 1000
{{/gte}}
Show every “active” custom property in a bulleted list.
{{! Show me the name of every SKU property that is "active" on this line item.}}
{{assign "typologies" (pluck (pluck (filterBy (values deal.skus.TransactionMonitoringTypologies.properties) "status" "=" "active" )) "friendlyName") }}
{{#each typologies}}
- {{this}}
{{/each}}
Dynamically display line item description based on SKU Custom Properties.
{{! Show different line item description and text specific depending
on the number of SKU properties that are "Active".
}}
{{! COUNT NUMBER OF TYPOLOGIES WERE PURCHASED }}
{{assign "typologyCount" (length (pluck (filterBy (values deal.skus.ExampleTypologies.properties) "status" "=" "active" ))) }}
Number of Typologies purchased: {{typologyCount}}
{{#lte typologyCount compare=4 }} Included. {{/lte}}
{{#eq typologyCount 5}} Price/Typology: $14063 {{/eq}}
{{#eq typologyCount 6}} Price/Typology: $13125 {{/eq}}
{{#eq typologyCount 7}} Price/Typology: $12188 {{/eq}}
{{#eq typologyCount 8}} Price/Typology: $11250 {{/eq}}
{{#eq typologyCount 9}} Price/Typology: $10313 {{/eq}}
{{#eq typologyCount 10}} Price/Typology: $9375 {{/eq}}
{{#eq typologyCount 11}} Price/Typology: $8438 {{/eq}}
{{#eq typologyCount 12}} Price/Typology: $7500 {{/eq}}
Dynamically display line item description based on an option selected on the SKU property that also shows another SKU property.
Number of Payslips: {{#switch current.sku.properties.payroll-frequency.selected.friendlyName}} {{#case "Monthly"}}
{{current.sku.properties.total-employees.value}} {{/case}} {{#case "Lunar"}} {{multiplyAll current.sku.properties.total-employees.value 1.083}}
{{/case}} {{#case "Fortnight"}} {{multiplyAll current.sku.properties.total-employees.value 2.17 }}{{/case}} {{#case "Weekly"}} {{multiplyAll current.sku.properties.total-employees.value 4.333}}{{/case}} {{/switch}}
Conditional Display of Line Item Description based on two SKU custom properties.
{{#and (gte current.sku.properties.employees.value compare=1) (lte current.sku.properties.employees.value compare=100) }}
{{#eq current.sku.properties.cintra-payroll.status "active"}} SasS Payroll £500{{/eq}}
{{#eq current.sku.properties.outsource-payroll.status "active"}} Outsource Payroll £500 {{/eq}}
{{#eq current.sku.properties.timesheet.status "active"}} Timesheet £250 {{/eq}}
{{#eq current.sku.properties.admin-support.status "active"}} Admin Support £125 {{/eq}}
{{/and}}
{{#and (gte current.sku.properties.employees.value compare=101) (lte current.sku.properties.employees.value compare=200) }}
{{#eq current.sku.properties.cintra-payroll.status "active"}} SasS Payroll £850 {{/eq}}
{{#eq current.sku.properties.outsource-payroll.status "active"}} Outsource Payroll £850 {{/eq}}
{{#eq current.sku.properties.timesheet.status "active"}} Timesheet £250 {{/eq}}
{{#eq current.sku.properties.admin-support.status "active"}} Admin Support £125 {{/eq}}
{{/and}}
Deal Pricing
Deal pricing operators allow you display custom pricing information based on your own calculations.
Define Progressive (Graduated) Tiered Pricing with dynamic formula
To add tiering to your SKU, use the Dynamic Pricing feature. Navigate to the Pricing tab and choose Use a dynamic price formula instead beneath the list price input field.
You should see the Dynamic Pricing configuration page. Choose Price by a custom formula from the "Use" dropdown so that the custom formula markdown box appears.
In the formula box, write the code to define your progressive tiered pricing. Below is an example of some pricing tiers and the associated code that matches the table. In the example code provided below, you only need to edit the tierCosts and tierLimits variables. The tierCosts variable stores a list of the prices associated with each tier, and similarly, the tierLimits variable stores the maximum quantity that each tier should apply to. Copy the code below into the formula box and make modifications to it per your pricing requirements.
| Min Quantity | Max Quantity | Price/Seat |
|---|---|---|
| 1 | 10 | $25 |
| 11 | 50 | $20 |
| 51 | 100 | $15 |
Display the monthly subtotal of all SKUs.
This operator sums up the monthly price of all line items on the deal. Metered SKUs and one-time SKUs do not have a monthly price and will not be included.
This operator is also an example of using HTML in markdown to format the text differently (as a H4 heading), on the right side of the document.
{{! Sums up the monthly price of all SKUs, then formats the number in
US currency, with a comma and 2 decimal places.
Metered SKUs and one-time SKUs do not have a monthly price and will not be included.}}
<h4>
<div align="right"> Your Monthly Services: ${{addCommas (toFixed (sum (pluck (values deal.skus) "monthlyPrice")) 2) }}/month
</h4>
Display the annual subtotal of all SKUs.
Similar to the above but for annual subtotal.
<h4>
<div align="right"> Your Annual Services: ${{addCommas (toFixed (sum (pluck (values deal.skus) "annualPrice")) 2) }}/month
</h4>
Display subtotal of one time pricing products (non-recurring subtotal)
This operator sums up only the line items on the deal that are one time fees
{{! Sums up the price of all line items that have a one-time unit
pricing schedule. }}
{{assign "onetimeFee" (sum (pluck (filterBy (values deal.skus) "unitPricingSchedule" "=" "one-time" ) "netPrice" )) }}
#### One Time Cost: ${{addCommas onetimeFee }}
Display pricing of monthly and one time services as well as added together.
{{! Sums up the monthly price of all SKUs. Then, sums up the price
of all line items that have a one-time unit pricing schedule.
Displays each on their own as well as added together.
}}
{{assign "monthlyFee" (sum (pluck (values deal.skus) "monthlyPrice")) }}
{{assign "onetimeFee" (sum (pluck (filterBy (values deal.skus) "unitPricingSchedule" "=" "one-time" ) "netPrice" )) }}
#### Monthly Services: ${{addCommas monthlyFee}}/month
#### One Time Cost: ${{addCommas onetimeFee}}
---
## Total Due Today: ${{sum monthlyFee onetimeFee}}