Handlebars Sum multiple products
I have this little 1-2 liner right here. It multiplies price times amount for 3 different items. Is there any way to sum up all 3 values?
{{ times Form.Fields.Item#1price Form.Fields.Item#1amount times Form.Fields.Item#2price Form.Fields.Item#2amount times Form.Fields.Item#3price Form.Fields.Item#3amount }}
0
Comments
Hi Kevin Laugwitz,
It looks like you're using the wrong tags for your handlebars expression. You can multiply then sum the fields using the add and multiply handlebars helpers. I got something approximating what I think you're asking for using the following strategy:
The context record I used for this expression was:
The expression above yields the following result:
Let us know if that's still not working for you.
Please sign in to leave a comment.