Adding product descriptions to invoice. Need duplicate items to only show information once.

mark4986
New Member
3 0 0

Sorry for the confusing title... Below is the code I wrote to add product descriptions relative to line items to invoices. The problem I can't seem to solve is that my products (beer) are divided into different units (can cases and kegs) and therefore if a can case and a keg of the same product occur on the invoice, the product description outputs twice.

 

Does anybody have any thoughts on how to make it so the description only outputs once?

 

Thanks!

 

 

{% for line_item in line_items %}

{% unless line_item.product.title contains 'Fee' %}
{% if line_item.product.title contains '(Can Case)' %}
<b>{{ line_item.product.title | remove: "(Can Case)"}}
{% elsif line_item.product.title contains '(1/6 Keg)' %}
<b>{{ line_item.product.title | remove: "(1/6 Keg)" }}
{% else %}
<b>{{ line_item.product.title | remove: "(1/2 Keg)" }}
{% endif %}

{{ line_item.product.description }}<br><br>
<p>-------------------------------------------------------------</p>
{% endunless %}

{%endfor%}

 

Replies 0 (0)