We are producing Invoices with Shopify’s ‘Order Printer’ app.
and want to customise the Invoice.
For instance, if they have bought a ‘book’ – we want it to say “Enjoy your book”
and if a ‘CD’ – “Enjoy the music”.
I’ve found I can test the first item they purchased with ‘limit:1’ :
{% for line_item in unfulfilled_line_items limit:1 %}
productType: {{ line_item.product.type }} - prodtype:{{product.type}} <br/>
{% if line_item.product.type contains "cd" %}
its a CD <br/>
{% else %}
it's not a CD?)<br/>
{% endif %}
{% endfor %}
But I would really like to scan the whole of the product.type array to determine how many of each product type there are – and output either/both messages – with plural ‘s’ as appropriate.
Any ideas?
2
Answers
Thanks @trowse - solved the zeros issues, they were due to OrderPrinter cache problems and limitations. Just in case anyone needs it. Here's our solution:
You’re on the right track instead of limiting though you basically want to count.
Now that you have a count you should be able to just do an if statement of the count numbers.