Hi there,
I’d like to add an order-specific image into the Shipping confirmation email that the customer receives, without having to upload it to the Files section.
Context: when we ship an order, we send a photo of the items packaged for delivery. Currently we are doing this as a seperate manual email but it’s getting tedious and I’d love to automate it.
I have created a custom order metafield for an image file, but cannot work out how to display this image in the shipping email.
I have also had a play with adding the image to the timeline comments, but cannot get this to display either.
I’ll attach some screenshots showing the metafield configuration, and the image attached to the order:
I have tried a variety of codes in the email template, the latest being:
{% assign image_url = order.metafields.custom.shipment_image %}
{% if image_url != blank %}
![{{ image_url.value.alt }}]()
{% endif %}
I would appreciate any ideas on how to achieve this, and if it’s through code, advise on where exactly within the template it should be added.
Thank you!
Hi @SophiePeacock01 ,
I am from Mageplaza - Shopify solution expert.
What you’ve done so far is quite good. However, the image is still not displaying in the shipping email because the image link from the metafield (type: file) points to Shopify’s admin CDN (cdn.shopify.com/…), which is not publicly accessible.
Therefore, please change the metafield type from ‘file’ to ‘URL’. You can use an image hosted on a publicly accessible service such as:
- Imgur
- Dropbox (convert the link to a direct download format)
- AWS S3 (with public-read permission)
- Cloudinary
- Alternatively, you can upload the image via Content → Files, then copy the image link after uploading.
After that, refer to the following code to include the image in the shipping email:
{% assign image_url = order.metafields.custom.img_tracking %}
{% if image_url != blank %}
image tracking
{% endif %}
Screenshort:
Please let me know if it works as expected!
Best regards!
Hi there,
Thanks for your reply! Since I posted this thread, I have worked this part out and it works perfectly. Thanks!
However, the issue I have now is timing.
I have set a workflow to automatically convert the image file to a url, which runs every ten minutes to check if there is a file, and convert into a url in a seperate meta field. Then, I’d like the flow to check if the url exists, then fulfill the order, however we are using an external shipping label app which fulfills the order and assigns the tracking number. So I can’t work out how to restrict fulfilment to when the tracking number has been assigned AND the image has been converted.
I just want the process to be as seamless and few steps as possible for the team processing the orders.
Any ideas? Hopefully this all makes sense.