That worked fine! Thanks @lubos !!
Now, I am having problem to calculate total savings as there seem to be some issue with text to decimal conversion.
In the default sales invoice template, I have added the following code.
{% assign savings=0 %}
{% for line in lines %}
{% assign item_mrp = line.item.custom_fields.MRP | plus: 0 %}
{% assign item_saving = item_mrp | minus: line.unit_price | times: line.qty %}
{% assign savings = savings | plus: item_saving %}
The ‘item_mrp’ has the right value. However, following error message
is thrown at {% assign item_saving = item_mrp | minus: line.unit_price | times: line.qty %}
“Liquid error: Parameter count mismatch”
I am new to Liquid. Am I missing something in the above code?
Why any arithmetic expression using ‘item_mrp’ after its first assignment fails? Please help to resolve this.