Quantcast
Channel: Opinion: Shopify Community - Shopify Apps
Viewing all articles
Browse latest Browse all 11091

Order Printer Sum of Taxes at certain Tax rate by Robert Marian

$
0
0

Hey guys,

My accountants asked me to add several tax lines to our invoices instead of just one. Since we have two VAT rates 9% and 20%, they asked me for:

  • a line which shows the total tax at 9%
  • a line which shows the total tax at 20%
  • a line which shows the sum of both totals

I know that the following gives me a list of all the individual taxes at 9% tax rates aka the VAT paid on every line which's tax rate is 9%, but I can't figure out how to add them together and get their total.

        {% capture tax9 %}
        {% for line_item in line_items %}
        {% for tax_line in line_item.tax_lines %}
        {% if tax_line.rate == 0.09 %}
            {{ tax_line.price | times: line_item.quantity | money_without_currency }}
        {% endif %}
        {% endfor %}
        {% endfor %}
        {% endcapture %}
        {{ tax9 }}

e.g. the above code results in somthing like this:  0.14 0.25 0.35 1.5

Anything else I try that should get me to the sum of these, fails.

I hope one of you guys knows a fix for this.

 

 


Viewing all articles
Browse latest Browse all 11091

Trending Articles