Solved

Add line item properties to Order Confirmation

LaBruce
Visitor
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

Accepted Solution (1)

themecaster
Excursionist
30 10 19

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.

View solution in original post

Replies 10 (10)

themecaster
Excursionist
30 10 19

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.
LaBruce
Visitor
2 0 0
Thank you! That worked. Much appreciated!

LB
JamiCreates
Tourist
17 0 3

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

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?

JamiCreates
Tourist
17 0 3

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!

Everfan
Tourist
6 0 1

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

JamiCreates
Tourist
17 0 3

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

fb_cookies
Visitor
1 0 1

This is awesome! 

Is there a way to only include specific line item properties? It seems by adding .first and .last includes all line item properties. We want to only include one out of the several line items on the packing slip?

PublicApps
Shopify Partner
146 5 34

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.

 

Public Apps | Theme customization & App development
 - Was my reply useful? Like it to let me know!
 - Did I answer your question? Please mark as Accepted Solution.
 - Need more help? Contact us.