for instance
<div class="price">{{blocks.quantity}} x {{blocks.price}} </div>
i want to multiply price by quantity
data from Json file.
for instance
<div class="price">{{blocks.quantity}} x {{blocks.price}} </div>
i want to multiply price by quantity
data from Json file.
There are multiple ways to do this, including building filters.
One simple way would be to define it in the template where you will use the value:
You could then say:
You could also then use this in the logic:
Finally you can just express it like this
{{blocks.quantity*blocks.price}}
, as previous commenter Sauntimo said already.You should be able to execute mathematical operations inside double curly braces like this:
See the docs at https://mozilla.github.io/nunjucks/templating.html#math