Displaying shipping tax in Order Printer

Highlighted
New Member
1 0 1

Hello everyone, 

 

I hope I'm posting this in the right section of the forum. I have a question regarding Shopify’s native Order Printer app, specifically about the option of displaying shipping tax. Our store charges taxes on shipping, and what I would like to accomplish is to display the subtotal shipping cost (without the tax) besides the total shipping cost (which is displayed by default). Order Printer doesn’t seem to have an option for enabling this, and it also doesn’t display the shipping tax amount or rate. The shipping tax is simply added to the total tax amount of the whole order. The customer, therefore, has to look at the total tax amount of their entire order and that of their items, and then figure out that taxes had been applied to shipping.

 

I have read the documentation for this at https://help.shopify.com/en/themes/liquid/objects/tax_line and could not find a solution. Liquid templating language has variables like: {{ tax_line.price | money }} etc., but none of these variables are suitable for what I want to accomplish. Is there a variable for this or is there a way to use the variables to calculate the amount in a custom way?

Any help would be greatly appreciated.

1 Like
Highlighted

Hey Nadja,

 

You are right, the Order Printer by Shopify app does not provide the tax amount charged on shipping costs. So you would need to calculate it yourself. Here's how:

 

{% assign line_item_taxes = 0.0 %}
{% for line_item in line_items %}
  {% for tax in line_item.tax_lines %}
    {% assign line_item_taxes = line_item_taxes | plus: tax.price %}
  {% endfor %}
{% endfor %}

{% assign shipping_tax = total_tax | minus: line_item_taxes %}

{{ shipping_tax | money }}

Hope it helps :)

 

Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes
Highlighted
New Member
2 0 0

Hello, 

I have the same problem as Nadja, could you tell me where do I have to copy and paste this code? I tried but it didn't work. Thank you

0 Likes
Highlighted

Hey there,

 

It really depends on your template code, and where you would like it displayed. If you attach a text file containing your current template code, then I can perhaps help get it included for you :)

 

Thanks,

Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
1 Like
Highlighted
New Member
2 0 0

Hello, I use the default code of the order printer app.

I'd need to put the shipping as an item of the list, and in the 'tax field' the summation of item taxes+ shipping taxes.

The third question is: is there a way to set the n° of the invoice automated or to modify it each time? Because I have to restart the sequence each year here in Italy and it doesn't match with the order number of the site (e.g.#34).

Thank you for your reply, I hope I explained it well, sorry for my English!

 

Here is the code:

<p style="float: right; text-align: right; margin: 0;">
{{ "now" | date: "%m/%d/%y" }}<br />
Fattura per {{ order_name }}
</p>

<div style="float: left; margin: 0 0 1.5em 0;" >
<strong style="font-size: 2em;">{{ shop_name }}</strong><br /><br />
{{ shop.address }}<br/>
{{ shop.city }} {{ shop.province_code }} {{ shop.zip | upcase }}<br/>
{{ shop.country }}
</div>

<hr />

<h3 style="margin: 0 0 1em 0;">Item Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
{% if show_line_item_taxes %}
<th>Taxes</th>
{% endif %}
<th>Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td><b>{{ line_item.title }}</b></td>
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} {{ tax_line.title }}<br/>
{% endfor %}
</td>
{% endif %}
<td>
{% if line_item.original_price != line_item.price %}
<s>{{ line_item.original_price | money }}</s>
{% endif %}
{{ line_item.price | money }}
</td>
</tr>
{% endfor %}
</tbody>
</table>

{% if transactions.size > 1 %}
<h3 style="margin: 0 0 1em 0;">Transaction Details</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Type</th>
<th>Amount</th>
<th>Kind</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td>{{ transaction.gateway | payment_method }}</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.kind }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}

<h3 style="margin: 0 0 1em 0;">Payment Details</h3>

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<tr>
<td>Subtotal price:</td>
<td>{{ subtotal_price | money }}</td>
</tr>
{% for discount in discounts %}
<tr>
<td>Includes discount "{{ discount.code }}"</td>
<td>{{ discount.savings | money }}</td>
</tr>
{% endfor %}
<tr>
<td>Total tax:</td>
<td>{{ tax_price | money }}</td>
</tr>
{% if shipping_address %}
<tr>
<td>Shipping:</td>
<td>{{ shipping_price | money }}</td>
</tr>
{% endif %}

<tr>
<td><strong>Total price:</strong></td>
<td><strong>{{ total_price | money }}</strong></td>
</tr>
{% if total_paid != total_price %}
<tr>
<td><strong>Total paid:</strong></td>
<td><strong>{{ total_paid | money }}</strong></td>
</tr>
<tr>
<td><strong>Outstanding Amount:</strong></td>
<td><strong>{{ total_price | minus: total_paid | money }}</strong></td>
</tr>
{% endif %}
</table>

{% if note %}
<h3 style="margin: 0 0 1em 0;">Note</h3>
<p>{{ note }}</p>
{% endif %}

{% if shipping_address %}
<h3 style="margin: 0 0 1em 0;">Shipping Details</h3>

<div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
<strong>{{ shipping_address.name }}</strong><br/>
{% if shipping_address.company %}
{{ shipping_address.company }}<br/>
{% endif %}
{{ shipping_address.street }}<br/>
{{ shipping_address.city }}
{{ shipping_address.province_code }}
{{ shipping_address.zip | upcase }}<br/>
{{ shipping_address.country }}
</div>
{% endif %}

<p>If you have any questions, please send an email to <u>{{ shop.email }}</u></p>

0 Likes
Highlighted

Hey there,

 

I checked your template code, and it already contains the "Shipping" and "Total tax" in the template:

 

 

Note: These will only appear if you have setup your Shopify admin to charge taxes and shipping on your orders. So if you are not seeing them in your documents, I would suggest double checking that they are setup correctly. The Shopify Support team can help you get it setup if needed.

 

Regarding the last part about the order number, you can do that by adjusting the order number in the code, at the end of each year.

 

Change this line of code:

 

  Fattura per {{ order_name }}

To be the following instead:

 

  Fattura per #{{ order_number | minus: 0 }}

Then adjust the 0 in above code to the number needed to reset it to 1 each year. So if your order number is currently 100, you would set it to be minus: 99 to get you back to 1.

 

Hope it helps.

 

Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
0 Likes