Solved

Remove Products from Order Printer Invoice That Have Zero Quantity

Hannah_M
Excursionist
11 0 6

Hi,

We are using the Order Printer app for our invoices and packing notes. I changed the layout etc and a few other things, but that's as far as my coding skills go.

Our issue is that when we have refunded for an item, it still shows on the invoice. We thought we could live with it, but today I was playing around with a particular invoice, where we'd done a refund for one item, and then customer wanted to add an item, then changed their mind, so I removed the item.  We don't want the invoice displaying products we've added and then removed. So along with the refunded product the invoice now looks a complete mess!  

Is there any code that I could perhaps state, only display items with quantity more than 1? This would resolve the issue with the refunded items and anything removed.

Any help would be greatly appreciated!

Hannah

Accepted Solutions (2)
nichinu
Visitor
1 1 3

This is an accepted solution.

Had the same issue. I solved it by:

adding " {% if line_item.quantity > 0 %} " after " {% for line_item in line_items %}"

and adding "{% endif %}" after "{% endfor %}"

. All without the quotes.

View solution in original post

CalvinOU812
Excursionist
12 2 2

This is an accepted solution.

Thank you nichinu,

That's what I was going to do, but your post confirmed it.

I added it a little differently and it seems to be removing the items with zero (0) quantities properly from the invoice. Here is what my code for the entire table looks like:

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
<th>Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
{% if line_item.quantity > 0 %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td>{{ line_item.title }}</td>
<td>{{ line_item.line_price | money }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

Best regards.

View solution in original post

Replies 10 (10)

Origins
Visitor
2 0 1

Same issue here. All invoices are messed up. All shopify stores have this issue its not just us. Whenever a product is removed the storefront account page and the invoices  keep the product in there. It is simply astonishing that such a simple use case has not been addressed. I read somewhere that only if you do some custom implementation with webhooks you can achieve this but no clue.

EimanS
Tourist
6 0 3

Hi. In my case, to print invoices without the removed items I changed this line:

 

{% for line_item in line_items %}

 

to this:

 

{% for line_item in fulfilled_line_items %}

 

 

Just make sure to print the invoice after fulfillment. Hope this helps

nichinu
Visitor
1 1 3

This is an accepted solution.

Had the same issue. I solved it by:

adding " {% if line_item.quantity > 0 %} " after " {% for line_item in line_items %}"

and adding "{% endif %}" after "{% endfor %}"

. All without the quotes.

CalvinOU812
Excursionist
12 2 2

This is an accepted solution.

Thank you nichinu,

That's what I was going to do, but your post confirmed it.

I added it a little differently and it seems to be removing the items with zero (0) quantities properly from the invoice. Here is what my code for the entire table looks like:

<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
<th>Price</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
{% if line_item.quantity > 0 %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td>{{ line_item.title }}</td>
<td>{{ line_item.line_price | money }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>

Best regards.

Hannah_M
Excursionist
11 0 6

Perfect - thank you!

Apart from it would only work with {% endif %}  before  {% endfor %}.

As CalvinOU812

Rashid035
Visitor
2 0 0

Hi am new . I don't know where to add this code. Can you please help us.

 

Rashid035
Visitor
2 0 0

Where I have to update this code can you please update us ?

CalvinOU812
Excursionist
12 2 2

Hello,

1) You need to install the free Shopify "Order Printer" app.  Search for "Order Printer" in the Shopify App Store.

2) After it's installed, in Shopify, go to Apps and click on the Order Printer app.

3) Click "Message templates".

4) In the Invoice Template row, click "Duplicate Template".  Leave the original for future reference.

5) Edit the duplicated invoice.

Experiment and have fun.

DigitalCare
Visitor
2 0 0

Vou deixar uma dica!

Algumas empresas podem resolver este problema com o serviço de Outsourcing de Impressão, essas empresas costumam ter técnicos que ajudam nas configurações.

Saiba mais sobre locação de impressoras acessando o link abaixo!

 

https://rpmsolucoesemimpressao.com.br/blog/

RayRayF
Visitor
2 0 5

Three years later and its the same issue.