Overview
Line Item properties are very common among third party applications as well as other custom work. If you have any custom fields on your product page which may be used to collect a bit of information about the desired features of a product, you may notice that they might not be sending through to the Easy Purchase Orders app. We certainly want to ensure that your existing functionality works properly with our app, so we have made the following tutorial to help display the collected data about a product within your Purchase Orders.
If you follow the steps outlined below, adding the custom field values to your Purchase Orders will be a breeze!
Email Template
Step 1: Locate Your Templates
Navigate to the Templates page by clicking on the "Templates" link in the main navigation at the top of our app. Then, make sure you're editing the Email Template, by clicking on the "Email" link on the left hand side of the page.
Step 2: Find the Product Title
Now that you're editing the Email Template, we will need to locate the loop that is showing the products.
You can find this loop by scrolling inside of the editor and looking for this line (Mine was on line 127, yours may be on a different line number):
{% for line in line_items %}
This line will loop through all of the products in your Purchase Order, and display the details of that specific product. Typically, it is common practice to show the Line Item Properties directly underneath the Product Title. So lets locate this line now.
The title of the product should be displayed by a line that looks like this:
{{ line_title }}
Step 3: Paste the Code!
Once you have found this snippet, click at the very end of the line that the snippet is on, press the enter key, and then paste the following code:
<br />
{% assign property_size = line.properties | size %}
{% if property_size > 0 %}
<p>
{% for p in line.properties %}
{% assign first_character_in_key = p.name | truncate: 1, '' %}
{% unless p.value == blank or first_character_in_key == '_' %}
<small>{{ p.name }}:</small>
{% if p.value contains '/uploads/' %}
<a target="_blank" href="{{ p.value }}"><small>Link</small></a>
{% else %}
<small>{{ p.value }}</small>
{% endif %}
<br>
{% endunless %}
{% endfor %}
</p>
{% endif %}
Your finalized Code should look something like this:
Step 4: Save!
You're done! Just click the Green "Save" button underneath the editor, and your Email Templates will now show any custom form fields that you have on your product pages which are using Line Item Properties to store the data!
PDF Template
Step 1: Locate your Templates
Navigate to the Templates page by clicking on the "Templates" link in the main navigation at the top of our app. Then, make sure you're editing the PDF Template, by clicking on the "Purchase Order PDF" link on the left hand side of the page.
Step 2: Find the Product Title
Now that you're editing the PDF Template, we will need to locate the loop that is showing the products.
You can find this loop by scrolling inside of the editor and looking for this line (Mine was on line 151, yours may be on a different line number):
{% for line in line_items %}
This line will loop through all of the products in your Purchase Order, and display the details of each specific product. Typically, it is common practice to show the Line Item Properties directly underneath the Product Title. So lets locate this line now.
The title of the product should be displayed by a line that looks like this:
{{ line_title }}
Step 3: Paste the code!
Once you have found this snippet, click at the very end of the line that your snippet is on, press the enter key, and then paste the following code:
{% assign property_size = line.properties | size %}
{% if property_size > 0 %}
<p>
{% for p in line.properties %}
{% assign first_character_in_key = p.name | truncate: 1, '' %}
{% unless p.value == blank or first_character_in_key == '_' %}
<small>{{ p.name }}:</small>
{% if p.last contains '/uploads/' %}
<a target="_blank" href="{{ p.value }}"><small>Link</small></a>
{% else %}
<small>{{ p.value }}</small>
{% endif %}
<br>
{% endunless %}
{% endfor %}
</p>
{% endif %}
Your finalized Code should look something like this:
Step 4: Save!
You're done! Just click the Green "Save" button underneath the editor, and your Purchase Order PDF Templates will now show any custom form fields that you have on your product pages which are using Line Item Properties to store the data!