add product metafield in order confirmation email

I have metafield in product page under product title

if this metafield have data, I also want it to show on order confirmation email

and if it have not data, it will not show it

can you help me edit code order confirmation?

Hey @X8d3 ,

To display the product metafield (like a shipping date) in the order confirmation email, you can edit the Shopify “Order Confirmation” notification template in your admin:

  • Go to Shopify Admin → Settings → Notifications

  • Click on “Order Confirmation”

  • Scroll down to the email body (HTML) section

Sample Code to Add (Check for metafield and display it if available):

Find where the product title is shown inside the loop (usually inside {% for line in line_items %}), and right under that, add this:

{% if line.product.metafields.custom.ship_out_date != blank %}
  

    SHIP OUT: {{ line.product.metafields.custom.ship_out_date.value | date: "%Y-%m-%d" }}
  

{% endif %}
  • Replace custom with the correct namespace of your metafield.

  • Replace ship_out_date with the exact key of your metafield.

  • If the metafield is a date type, you can use .value | date: “%Y-%m-%d” to format it.

{% for line in line_items %}
  
    
      {{ line.title }}
      {% if line.product.metafields.custom.ship_out_date != blank %}
        

          SHIP OUT: {{ line.product.metafields.custom.ship_out_date.value | date: "%Y-%m-%d" }}
        

      {% endif %}
    
    {{ line.quantity }}
  
{% endfor %}

Let me know your exact metafield namespace + key if you’re not sure, and I can plug that into a working code snippet for you.

Please Feel Free to Reach out me Thanks!

Best Regards,

Rajat

Shopify Expert

Hi @X8d3 ,

Please go to Settings > Notifications > Customer notifications > Order confirmation > Edit code > Find ‘order-list__product-description-cell’ and add code:

{{ line.product.metafields.custom.name metafield }}

I put it and they show on preview on email order confirm template

but when I test order it not show on email

they have multiple ‘order-list__product-description-cell’ do I have to put it all under that section

I try but when I test with draft order they not show it

Hi @X8d3 ,

Have you changed the name of the metafield and tried adding it to all 3 locations?

I change the name meta but I just add it on one of ‘order-list__product-description-cell’.

‘order-list__product-description-cell’. how many section that they have?

@X8d3 ,

Thanks for the screenshots — this is a common issue: metafields often don’t appear in real order confirmation emails like they do in the preview. Feel free to reach out if you’d like assistance getting it set up correctly.

by setting up this up, do I have to pay addition price for you or don’t?

No worries at all, I’m happy to help without any payment — but if you choose to support me, that’s totally up to you. Feel free to ping me on email anytime. Thanks!

Hi @rajweb ,

Can I send you a collaborator invitation? It will help me check the details.