Multiplying quantity and price in Message Center handlebars template

Hello,

I’m creating a customized e-mail on message center and I need to multiply the value of an item by its quantity, but when I add formatCurrency I get NaN as the response.

This is how I did it in my template:

{{#if orders}}
{{#each orders}}
{{#each items}}

{{multiply quantity formatCurrency sellingPrice}}

{{/each}}
{{/each}}
{{/if}}

If I remove formatCurrency, the value is displayed without the decimal separator. Can I do this in any other way? Thanks!

Hi @victorluna12! Turns out you are using the wrong syntax for Handlebars Subexpressions. Adding parentheses should do the trick:

{{#if orders}}
{{#each orders}}
{{#each items}}

{{formatCurrency (multiply quantity sellingPrice)}}

{{/each}}
{{/each}}
{{/if}}

If you want more details about the implementation of formatCurrency, you can check out the source code for our helpers on Github.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.