I have two metafields on a product to toggle if the product is a pre-order and also an expected delivery date.
I can get the delivery date pulled into the email notification, however, my code to query the Boolean of the pre-order field doesn’t seem to work in the email notification. Yet the same code works on the product template.
Here is my code:
{% for line in subtotal_line_items %}
{% if line.product.metafields.custom.preorder %}
<p style="font-weight: bold;color:#ff0000;">IMPORTANT:<br/> Your order contains a pre-order item.<br/>Your order will ship by {{ line.product.metafields.custom.release_date | date: "%B %d" }} or earlier.<br/><br/></p>
{% break %}
{% endif %}
{% endfor %}
Additionally in my testing, when I change the date on the product it can take a few hours to register in my test email notification. I would have assumed updating a metafield would update instantly in the email notification tests.
To test my code above I placed two live orders and tried the ‘resend email’ option in Shopify admin as it appears to grab the latest code for the order notification email.