line item properties in order notifications

Rollo
Excursionist
24 1 2

Hi,

The line item properties won't show up in the order notification email. 

{% for line in line_items %}
								<tr class="order-list__item">
								<td class="order-list__item__cell">
								  <table>
								    <td>
								      {% if line.image %}
								        <img src="{{ line | img_url: 'compact_cropped' }}" align="left" width="60" height="60" class="order-list__product-image"/>
								      {% endif %}
								    </td>
								    <td class="order-list__product-description-cell">
								      {% if line.product.title %}
								        {% assign line_title = line.product.title %}
								      {% else %}
								        {% assign line_title = line.title %}
								      {% endif %}
								
								      {% if line.quantity < line.quantity %}
								        {% capture line_display %} {{ line.quantity }} of {{ line.quantity }} {% endcapture %}
								      {% else %}
								        {% assign line_display = line.quantity  %}
								      {% endif %}
								
								      <span class="order-list__item-title">{{ line_display }} x {{ line_title }}</span><br/>
								
								      {% if line.variant.title != 'Default Title' %}
								        <span class="order-list__item-variant">{{ line.variant.title }}</span><br/>
								      {% endif %}
								      {% if line.line_item.properties %}
										<p>
											{% for p in line.line_item.properties %}
												{% unless p.last == blank %}
													{{ p.first }}:
			
													{% if p.last contains '/uploads/' %}
														<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a><br/>
													{% else %}
														{{ p.last }}<br/>
													{% endif %}
			
													{% endunless %}
											{% endfor %}
										</p>
										{% endif %}

								      
								      
								    </td>
								      <td class="order-list__price-cell">
								        {% if line.original_line_price != line.line_price %}
								          <del class="order-list__item-original-price">{{ line.original_line_price | money }}</del>
								        {% endif %}
								        <p class="order-list__item-price">{{ line.line_price | money }}</p>
								      </td>
								  </table>
								</td>
								</tr>
{% endfor %}

 

I use almost the same code for the shipping notification and it does show up. Any help appreciated. 

{% for line in fulfillment.fulfillment_line_items %}
				  <tr class="order-list__item">
				    <td class="order-list__item__cell">
				      <table>
				        <td>
				          {% if line.line_item.image %}
				            <img src="{{ line.line_item | img_url: 'compact_cropped' }}" align="left" width="60" height="60" class="order-list__product-image"/>
				          {% endif %}
				        </td>
				        <td class="order-list__product-description-cell">
				          {% if line.line_item.product.title %}
				            {% assign line_title = line.line_item.product.title %}
				          {% else %}
				            {% assign line_title = line.line_item.title %}
				          {% endif %}
				
				          {% if line.quantity < line.line_item.quantity %}
				            {% capture line_display %} {{ line.quantity }} of {{ line.line_item.quantity }} {% endcapture %}
				          {% else %}
				            {% assign line_display = line.line_item.quantity  %}
				          {% endif %}
				
				          <span class="order-list__item-title">{{ line_display }} x {{ line_title }}</span><br/>
				
				          {% if line.line_item.variant.title != 'Default Title' %}
				            <span class="order-list__item-variant">{{ line.line_item.variant.title }}</span><br/>
				          {% endif %}
							{% if line.line_item.properties %}
							<p>
								{% for p in line.line_item.properties %}
									{% unless p.last == blank %}
										{{ p.first }}:

										{% if p.last contains '/uploads/' %}
											<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a><br/>
										{% else %}
											{{ p.last }}<br/>
										{% endif %}

										{% endunless %}
								{% endfor %}
							</p>
							{% endif %}
				        </td>
					  </table>
	    			</td>
	  			</tr>
{% endfor %}

 

Replies 2 (2)

martha_p
Visitor
3 0 0

Hello,

please check site: https://www.envision.io/blogs/ecommerce-pulse/95036801-how-to-create-customizable-products-in-shopif...

Open the Order Confirmation email template and find the code {{ line.title }}.

Replace it with the following:

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

Save it und make a test.

For me worked this code. You can do the same way for order canceling. Please try it, but do a backup before.

Rollo
Excursionist
24 1 2

Hi Martha,

thanks for your answer. 

Leaving line_item out of {% for p in line.properties %} did it. 

Thanks Rolf