Add line item properties to Order Confirmation

Solved
LaBruce
New Member
2 0 0

Hi,

Here is the code I added to my product-template to get Name of Attendee and their email. What code can I add to the Order Confirmation email for that info to show? I see it on the Order and Summary page but I would like it to show up in the Order Confirmation email.

<p class="line-item-property__field">
<label for="attendees-name">Attendee's Name</label>
<input required class="required" id="attendees-name" type="text" name="properties[Attendee's Name]">
</p>
<p class="line-item-property__field">
<label for="attendees-email-address">Attendee's Email Address</label>
<textarea required class="required" id="attendees-email-address" name="properties[Attendee's Email Address]"></textarea>
</p>

 

Thanks,

LB

0 Likes

This is an accepted solution.

Hi LB:

This is possible. The code below adds the Attendee's Name and Attendee's Email will appear below the product title and quantity for each line item on the Order Confirmation Email.

Step 1. Open the Order Confirmation template: Settings > Notifcations > Order confirmation

Step 2. Add the following code between the selling plan name and refunded tag

          {% if line.selling_plan_allocation %}
            <span class="order-list__item-variant">{{ line.selling_plan_allocation.selling_plan.name }}</span><br/>
          {% endif %}

<!-- Start Custom Code -->
{%- for prop in line.properties -%}
<div>                     
    <span>{{ prop.first }}: </span>
    <span> {{ prop.last }}  </span>
<div>  
{%- endfor -%}   
<!-- End Custom Code -->

          {% if line.refunded_quantity > 0 %}
            <span class="order-list__item-refunded">Refunded</span>
          {% endif %}

 

 

If my response was helpful please Like and Mark As Solution.
0 Likes
LaBruce
New Member
2 0 0
Thank you! That worked. Much appreciated!

LB
0 Likes
JamiCreates
Tourist
11 0 1

Would a similar code be needed to add custom line-item property fields to the packing slip?

0 Likes
Everfan
Tourist
6 0 1

@themecaster I have a similar question but I need custom line item properties to show up on the packing slip. I know where to edit the packing slip but am having a hard time with the correct coding to make it appear. 

This is what I put in my Order Confirmation to make the custom inputs come in the emails:

<span>{{ line.title }}{% for p in line.properties %}{% unless p.last == blank %} - {{ p.first }}: {{ p.last }}{% endunless %}{% endfor %} </span>

What should I add to the packing slip to make the p line properties appear?

0 Likes
JamiCreates
Tourist
11 0 1

I believe this is the code I used. I got it to show on mine (poor memory and I forgot exactly what i did months ago), but this looks to be the correct code. Around line 133 on the packaging slip code.

 

{% unless line_item.properties == empty %}
<ul>
{% for property in line_item.properties %}
<li>{{ property.first }}: {{ property.last }}</li>
{% endfor %}
</ul>
{% endunless %}

Everfan
Tourist
6 0 1

Thank you so much - I'll try this!

0 Likes
Everfan
Tourist
6 0 1

@JamiCreates YOU ARE MY NEW HERO! Thanks for the help - it worked like a charm.

JamiCreates
Tourist
11 0 1

Glad it worked! I know I searched forever for a solution! So please pass it along if you see others asking similar questions

0 Likes
PublicApps
Shopify Partner
89 4 25

For new people finding this post, here's a video of me editing the order confirmation email template and pasting in the code to display custom line item properties.

 

Just trying to help out.
- If my reply was helpful, please Like it or mark it as Accepted Solution to let me know!
- Need store customizations? Then consider Hiring us.