Conditional text added to packing slip based on product type?

I want to be able to include a snippet of text (usage instructions link) at the bottom of the item list in the packing slip if the order contains one or more products of a certain type and variant name. 

I am working with this code, cobbled together from other posts here:

{% for line_item in line_items_in_shipment %}
{% if line_item.variant_title == Variant_A %}
<p>
Product instructions: https://shopify.com/product-instructions
</p>
{% endif %}
{% endfor %}

 This code works when using the preview button in the packing slip editor, but not when I save and test on a fulfilled order's packing slip. I am also not sure if this would work if there were multiple products in the order, since the packing slip preview only has one item in the example order. 

I also do not want it displayed mutiple times if the order contains multiple instances of the product variant. 

Monster, creature & cryptozoology patches, buttons & stickers.
0 Likes