Remove Products from Order Printer Invoice That Have Zero Quantity

Hannah_M
New Member
2 0 2

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

Origins
New Member
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
3 0 2

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
New Member
1 0 1

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
Tourist
7 1 0

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.

0 Likes