What's your biggest current challenge? Have your say in Community Polls along the right column.

Custom Metafield in Order comformation email repeating?

Custom Metafield in Order comformation email repeating?

AnimeEmporium
Visitor
1 0 0

Hiya so basically I would like to display my custom Metafields on the Order Comfirmation page so my customers are more informed.  I have looked on the forum and tried a few different bits of code but they all keep repeating in the customers email, It repeats by the same amount of different SKU's that are ordered.

Any help is greatly appricated 🙂


My Custom Metafields & how I'm attempting to Display them in the email.

[custom.availability]

[Product Title] [Qaunity]
[custom.release_date] / [custom.dispatch_time]
   (if product is in stock would like to swap release date for dispatch time)
   (Would like results to be 1 once per product and info the the relevent product)

(The result on Customers Order Comfirmation Emails)

Metafeild Display 2.PNGMetafiled Display 1.PNG


(Current Code)

Code.PNG


(Example Product from my site to show how the metafields are used)

Website Example.PNG


Any help is greatly appricated 🙂

Reply 1 (1)

whyshop
Shopify Partner
27 6 1

hi @AnimeEmporium 

The loop after "<td class="order-list__product-description-cell">"

 

{% for line in line_items %} {% endfor %}

 

is redundant,because it is  insisde the top loop

 

 {% for line in subtotal_line_items %}{% endfor %}

 

,therefore custom meta fields will be displayed repeatedly.

Remove your loop 

{% for line in line_items %} {/%endfor%}

and just use this code

{{ line.product.metafields.custom.release_date }}

 

 

 

Need a Shopify Specialist? Chat on WhatsApp
Contact iwhyshop@gmail.com for the solutions you need
Problem Solved? ✔Accept and Like solutions to help future merchants
Follow me on Facebook iwhyshop, Susbcribe to my YouTube iwhyshop.Author of app"Ws Instant Bulk Editor"-Batch edit prices instantly without complicated tasks