You can use the item.sku_code variable to show the SKU code(s) of an item in the Order Template. The sku_code variable at the line item level can potentially return multiple SKU codes if multiple sizes have been selected for the line item. If there are multiple codes, the codes will be separated by a comma.
Here is an example of how you can modify the default Order Template to show the SKU code(s) for a line item:
Default Code
Code to be modified highlighted in red:
<table class="hundred">
<thead>
<tr>
<th>Product</th>
<th>Color</th>
<th>Size / Qty</th>
<th class="text_right">Unit Price</th>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<th class="text_right">Discount</th>
<th class="text_right">Disc Unit Price</th>
{% endif%}
{% if order.has_taxes_against_items %}
<th class="text_right">Tax</th>
{% endif %}
{% endif %}
<th class="text_right">Qty</th>
<th class="text_right">Total</th>
</tr>
</thead>
<tbody>
{% assign colspan = 5 %}
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
{% assign colspan = colspan | plus:2 %}
{% endif %}
{% if order.has_taxes_against_items %}
{% assign colspan = colspan | plus:1 %}
{% endif %}
{% endif %}
{% assign row_count = 1 %}
{% for item in order.main_items %}
<tr>
<td class="text_left" {% unless item.has_sizes_or_colors? %} colspan="3" {% endunless %}>
{{ row_count }}.
{% if (item.supplier_product) and (item.is_not_freeform?) %}
{{ item.supplier_product.product_code }} -
{% endif %}
{{ item.product_name }}
{% if item.product_based? %}
<br />
{% else %}
{% if item.has_extra_options? %} : {% endif %}
{% endif %}
{{ item.extra_options }}
</td>
{% if item.has_sizes_or_colors? %}
{% if (item.is_freeform?) %}
<td class="text_left">{{ item.free_form_color }}</<span">td>
{% else %}
<td class="text_left">{{ item.color_names }}</td>
{% endif %}
{% if item.free_form_size %}
<td class="text_left">{{ item.free_form_size }}</td>
{% else %}
<td class="text_left">{{ item.sizes }}</td>
{% endif %}
{% endif %}
<td class="text_right">{{ item.currency_unit_price | simple_price_format }}</td>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<td class="text_right">
{{ item.discount_percent }}%
</td>
<td class="text_right">{{ item.currency_disc_unit_price | simple_price_format }}</td>
{% endif %}
{% if order.has_taxes_against_items %}
<td class="text_right"<span>{{ item.unit_tax | simple_price_format }}</td>
{% endif %}
{% endif %}
<td class="text_right">{{ item.qty }}</td>
<td class="text_right qty">{{ item.currency_full_price | simple_price_format }}</td>
</tr>
{% assign row_count = row_count | plus:1 %}
{% endfor %}
</tbody>
<tfoot>
<tr class="total">
<td colspan="{{colspan}}" class="text_right">Subtotal</td>
<td colspan="2" class="text_right">{{ order.main_item_price | simple_price_format }}</td>
</tr>
</tfoot>
</table>
Custom Code
Add/replace the code in red to the default code shown above as follows:
<table class="hundred">
<thead>
<tr>
<th>Product</th>
<th>Color</th>
<th>Size / Qty</th>
<th>SKU</th>
<th class="text_right">Unit Price</th>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<th class="text_right">Discount</th>
<th class="text_right">Disc Unit Price</th>
{% endif%}
{% if order.has_taxes_against_items %}
<th class="text_right">Tax</th>
{% endif %}
{% endif %}
<th class="text_right">Qty</th>
<th class="text_right">Total</th>
</tr>
</thead>
<tbody>
{% assign colspan = 6 %}
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
{% assign colspan = colspan | plus:2 %}
{% endif %}
{% if order.has_taxes_against_items %}
{% assign colspan = colspan | plus:1 %}
{% endif %}
{% endif %}
{% assign row_count = 1 %}
{% for item in order.main_items %}
<tr>
<td class="text_left" {% unless item.has_sizes_or_colors? %} colspan="3" {% endunless %}>
{{ row_count }}.
{% if (item.supplier_product) and (item.is_not_freeform?) %}
{{ item.supplier_product.product_code }} -
{% endif %}
{{ item.product_name }}
{% if item.product_based? %}
<br />
{% else %}
{% if item.has_extra_options? %} : {% endif %}
{% endif %}
{{ item.extra_options }}
</td>
{% if item.has_sizes_or_colors? %}
{% if (item.is_freeform?) %}
<td class="text_left">{{ item.free_form_color }}</td>
{% else %}
<td class="text_left">{{ item.color_names }}</td>
{% endif %}
{% if item.free_form_size %}
<td class="text_left">{{ item.free_form_size }}</td>
{% else %}
<td class="text_left">{{ item.sizes }}</td>
<td class="text_left"> {{ item.sku_code }}</td>
{% endif %}
{% endif %}
<td class="text_right">{{ item.currency_unit_price | simple_price_format }}</td>
{% if order.use_extra_line_item_columns %}
{% if order.has_a_discount %}
<td class="text_right">
{{ item.discount_percent }}%
</td>
<td class="text_right">{{ item.currency_disc_unit_price | simple_price_format }}</td>
{% endif %}
{% if order.has_taxes_against_items %}
<td class="text_right">{{ item.unit_tax | simple_price_format }}</td>
{% endif %}
{% endif %}
<td class="text_right">{{ item.qty }}</td>
<td class="text_right qty">{{ item.currency_full_price | simple_price_format }}</td>
</tr>
{% assign row_count = row_count | plus:1 %}
{% endfor %}
</tbody>
<tfoot>
<tr class="total">
<td colspan=<span">"{{colspan}}" class="text_right">Subtotal</td>
<td colspan<span">="3" class="text_right"<span">>{{ order.main_item_price | simple_price_format }}</td>
</tr>
</tfoot>
</table>
Comments
0 comments
Please sign in to leave a comment.