How can I show delivery estimate only for items with a certain tag on the order confirmation email?

I need to show eta only for orders containing currently available items. so I added a tag ‘eta’ for items with the qty > 0 and edited the eta part like this.

{% if consolidated_estimated_delivery_time %}
{% if line.product.tags contains ‘eta’ %}

Estimated delivery {{ consolidated_estimated_delivery_time }}

{% endif %} {% endif %}

However, the eta doesn’t even show for orders with ‘eta’ tagged items. What could be the reason this code doesn’t work? or if I want to show eta not by the tag, but for items with the inventory qty > 0 directly, how does this code need to be changed?

Thank you.

It looks like {{ line.product.tags }} is not an available variable: https://help.shopify.com/en/manual/orders/notifications/email-variables#line-item

Maybe you could use metafields instead?

If you don’t have a metafields app yet, just search “product metafields” in the app store, there are a bunch.