Skip to content

Instantly share code, notes, and snippets.

@basilkhan05
Created May 4, 2025 20:35
Show Gist options
  • Save basilkhan05/0388afacea473d3dce84fcbe5670ce24 to your computer and use it in GitHub Desktop.
Save basilkhan05/0388afacea473d3dce84fcbe5670ce24 to your computer and use it in GitHub Desktop.
Shopify order printer app packing slips with bin locations (using metafields)
<div>
<div class="columns">
<h1>Packing Slip</h1>
<div class="address">
<p style="text-align: right; margin: 0">
Order {{ order.order_name }}<br />
{% if order.po_number %}PO # {{ order.po_number }}<br />{% endif %} {{
order.created_at | date: "%B %e, %Y" }}
</p>
</div>
</div>
<div class="columns" style="margin-top: 1.5em">
<div class="address">
<strong>From</strong><br />
{{ shop.name }}<br />
{{ shop.address | format_address }}
</div>
{% if order.shipping_address %}
<div class="address">
<strong>Ship to</strong>
{{ order.shipping_address | format_address }}
</div>
{% endif %}
</div>
<hr />
<h2>Order Details</h2>
<table class="table-tabular" style="margin: 1em 0 0 0">
<thead>
<tr>
<th style="width: 15%; text-align: left">Qty</th>
<th style="width: 15%; text-align: left">Bin Location</th>
<th style="width: 70%; text-align: left">Item</th>
</tr>
</thead>
<tbody>
{% for line_item in order.line_items %}
<tr>
<td style="text-align: left">{{ line_item.quantity }}</td>
<td style="text-align: left">
{% assign variant_bin =
line_item.variant.metafields.inventory.stock_location_variant %} {%
assign product_bin =
line_item.product.metafields.inventory.stock_location %} {% assign
bin_location = variant_bin | default: product_bin %}
{% if bin_location != blank %} {{ bin_location }} {% endif %}
</td>
<td style="text-align: left">{{ line_item.title }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment