You can use the item.sku_code variable to show the SKU code(s) of an item in the Worksheet 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.
You can use the selected_option.sku_code variable to show the SKU code of an individual size within a line item in the Worksheet Template.
Worksheet Line Item SKU Custom Code Example
Here is an example of how you can modify the default Worksheet Template to show the SKU code(s) for a line item:
Default Code
<!-- ITEM START HERE -->
{% for item in order.main_items %}
<div class="lineitem">
<h2 class="heading_lineitem">
<span style="padding:0 10px;">ITEM: {{ item.number }}</span>
Custom Code
Add the code in red to the default code shown above as follows:
<!-- ITEM START HERE -->
{% for item in order.main_items %}
<div class="lineitem">
<h2 class="heading_lineitem">
<span style="padding:0 10px;">ITEM: {{ item.number }}</span><span style="padding:0 10px;">SKU: {{ item.sku_code }}</span>
Result
Worksheet Line Item Size SKU Custom Code Example
Here is an example of how you can modify the default Worksheet Template to show the SKU code for a particular size in a line item:
Default Code
Style Tag Section
Code to be modified highlighted in red:
#w1 .lineitem_summary_col2 {
float:left;
width: 145px;
}
#w1 .lineitem_summary_col3 {
float:right;
width: 445px;
}
Div Tag Section
<span class="size"><h3>Size</h3></span>
<span class="qty"><h3>Qty</h3></span>
</li>
{% if item.free_form_size %}
<li style="border-bottom:1px solid #F0F0F0;">
<span class="size">{{ item.free_form_size }}</span>
</li>
{% else %}
{% for selected_option in item.size_field.selected_options_sorted_by_size %}
<li style="border-bottom:1px solid #F0F0F0;">
<span class="size">{{ selected_option.option_name }}</span>
<span class="qty">{{ selected_option.option_qty }}</span>
</li>
{% endfor%}
Custom Code
Style Tag Section
Modified code highlighted in red:
#w1 .lineitem_summary_col2 {
float:left;
width: 250px;
}
#w1 .lineitem_summary_col3 {
float:right;
width: 445px;
}
#w1 .lineitem_summary_col2 .sku {
float:left;
width:30px;
display:block;
text-align:left;
}
Div Tag Section
Add the code in red to the default code shown above as follows:
<span class="size"><h3>Size</h3></span>
<span class="qty"><h3>Qty</h3></span>
<span class="sku"><h3>SKU</h3></span>
</li>
{% if item.free_form_size %}
<li style="border-bottom:1px solid #F0F0F0;">
<span class="size">{{ item.free_form_size }}</span>
</li>
{% else %}
{% for selected_option in item.size_field.selected_options_sorted_by_size %}
<li style="border-bottom:1px solid #F0F0F0;">
<span class="size">{{ selected_option.option_name }}</span>
<span class="qty">{{ selected_option.option_qty }}</span>
<span>{{ selected_option.sku_code }}</span>
</li>
{% endfor%}
Comments
0 comments
Please sign in to leave a comment.