Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hi,
I am trying to create a report, that prints the date, order number & shop at the top, then prints one page for each line item on the order, so that our production team can print dockets for each item on the order that needs to be made.
It needs to repeat the header information on each page, and one item line on each page, so if there were 5 different items on an order, there would be five dockets. This is what I have so far, but I can't make it page break after each line item.
I also have no clue how to repeat the header on each page either...
Help please! Thank you in advance.
<div class="divheader">
<b>ORDER DOCKET</b><br/><br/>
Order Date: {{ processed_at | date: "%d/%m/%y" }} <br />
Order Number: {{ order_name }} <br />
Customer: {{ customer.name }}</p>
<hr />
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Quantity</th>
<th>Item</th>
</tr>
</thead>
</div>
<tbody>
{% for line_item in line_items %}
<tr>
<div class="linecontent">
<td>{{ line_item.fulfillable_quantity }} x</td>
<td><b>{{ line_item.title }}</b></td>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if note %}
<h3 style="margin: 0 0 1em 0; color: red;">Order Notes</h3>
<p style="background-color: #FFFF00;">{{ note }}</p>
{% endif %}
<style>
.divheader {
text-align: center;
margin: 0 0 0 0;
width: 100%;
align-items: top;
margin-bottom: 30px;
}
.linecontent {
page-break-after: always;
}
</style>
Managed it, the only thing wrong is that the report always prints one blank page afterwards. But that's not the end of the world!
I've also got it to print the order line items after the main item in 2 colunmns, so it's easy to see on each docket what else needs to be made.
Thought I'd post this here just in case anyone else might find it useful.
{% assign line_items = line_items | sort: "title" %}
{% for line_item in line_items %}
{% if line_item.fulfillable_quantity >0 %}
<p style="text-align: center; margin: 0; font-size: 150%; text-decoration: underline; font-family: HelveticaNeueLTStd-Roman;">
<strong>TRADE MANUFACTURING DOCKET</strong><br><br></p>
<p style="text-align: left; margin: 0;">
Customer: <strong>{{ customer.name }}</strong> <br />
Order Date: <strong>{{ processed_at | date: "%d/%m/%y" }} </strong> <br />
Order No. <strong>{{ order_name }}</strong></p>
<p style="text-align: center;font-size: 125%;">
Quantity: <strong>{{ line_item.fulfillable_quantity }} </strong><br />
Item: <strong>{{ line_item.title }} </strong><br /></p>
<p style="text-align: justify; font-size: 100%; margin: 0; font-family: 'Azeret Mono', monospace;">
<div>
Machinist 1:............................................ Date:.................. <br /> <br />
Machinist 2:............................................ Date:.................. <br />
<span> </span>
</div>
<br>
{% if note %}
<strong>Note: {{ note | newline_to_br }}</strong>
{% endif %}
<p style="text-align: left; font-size: 80%;"> Order Details <br /></p>
<p style="font-size: 60%; columns: 60px 2;">
{% for line_item in line_items %}
{% if line_item.fulfillable_quantity >0 %}
{{ line_item.fulfillable_quantity }} x {{ line_item.title }} {{ variant.sku }} <br />
{% endif %}
{% endfor %}
</p>
<p style="page-break-after: always;"></p>
{% endif %}
{% endfor %}
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025