Packing slip - alphabetical sorting for items

Topic summary

Users are seeking ways to alphabetically sort items on Shopify packing slips, particularly challenging for orders with 100+ items.

Solution Found:
Multiple users confirmed a working code modification in the packing slip template (Settings → Shipping and Delivery → Edit Packing Slip Template, around line 97).

Working Code:
Replace:
{% for line_item in line_items_in_shipment %}

With:
{% assign lineitems = line_items_in_shipment | sort: "title" %}
{% for line_item in lineitems %}

Additional Findings:

  • The code can be modified to sort by SKU instead of title by replacing “title” with “sku”
  • Browser caching may show old versions when testing; try different orders to verify changes
  • Some users reported spacing issues after implementation, with items potentially printing outside margins on multi-page slips

Unresolved Questions:

  • How to sort by additional attributes like color/Option1 Value after initial title sort
  • How to group by product type with alphabetical sorting within each group
  • How to fix increased spacing/margin issues that waste paper
Summarized with AI on October 28. AI used: claude-sonnet-4-5-20250929.

This did not work for me. I modified the code and the following did work:

In your packing slip template, find the line:

{% for line_item in line_items_in_shipment %}

and replace it with

{% assign lineitems = line_items_in_shipment | sort: “title” %}
{% for line_item in lineitems %}

1 Like