Displaying Batch Info in Order Confirmation Emails
If you're tracking batch info and expiration dates, you may want to display this information in the order confirmation emails using Freshly Batch Inventory metafields. However, since order confirmation emails are triggered simultaneously with the webhook sent to the app, this prevents the app from adding these details beforehand.
To get around this, consider the following options for displaying batch information:
- Resending the Email: If you resend the email after some time has passed, the data will be included in the subsequent email.
- Exploring Alternative Emails: You might consider adding the code to emails like Shipping Confirmation, Ready to Ship, Delivered, etc.
The code necessary for this purpose is:
{% assign inventory_batches = order.metafields.freshly.inventory_batches %} {% for inventory_batch in inventory_batches %} <p> {% if line.line_item.id == inventory_batch.line_item_id %} <span class="item-description-line"> {{ inventory_batch.description }} </span> {% endif %} </p> {% endfor %}
Please note that this code needs to be inserted within the iteration of {% for line in fulfillment.fulfillment_line_items %}
as indicated in the reference provided below:
If you need assistance with implementing this code, please feel free to reach out to us. We're here to help you.