All things Shopify and commerce
Hello,
Does anyone know of a way to have the items on the packing slips or invoices sort in an alphabetical order? We can have up to 100+ items in an order and have been unsuccessful in finding a solution through Shopify.
Thank you,
Ryan
Don’t know if op is still looking for help, but I found this question when I was looking for the answer myself and wanted to post the answer for other people looking for it.
I don’t know HTML, and Shopify helpfully suggested I borrow money from them to pay an expert for one line of code. Luckily, I am related to a coder who fiddled with it until we got it working! I think Shopify’s default packing slip code is the same regardless of theme, so hopefully this will work for everyone.
Replace the line
{% for line_item in line_items_in_shipment %}
with these lines
{% assign sorted-list= line_items_in_shipment | sort: "title" %}
{% for line_item in sorted-list in line_items_in_shipment %}
Hope this helps someone else!
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 %}
This code worked for me, but I have a further question. Now that I have my packing slips sorted by title, is there anyway to further sort by "color" or "Option1 Value?"
Where do we find the original code to edit?
I do not have packing slip under templates in my theme
It's not in the theme code, you have to go through settings to find it. Go to Settings -> Shipping and Delivery -> Edit Packing Slip Template. Should be line 97 or thereabouts.
Ah yes, right!! Thank you it is working now.
I wonder if theme does affect it then? Double checked the code I posted and that is what is working for me. Good to know I should try your if that ever changes! Thanks for posting!
Brilliant, thanks! This just made my day 🙂
This worked and it is awesome! Thank you. The only thing is there is now more space between items...can't see where that would be coming from. Eventually a lot of paper will be consumed. Anyone have any ideas?
The spacing issue is worse than I thought. When the packing slip carries over to a second page, items are lost because they 'print' outside the printable margin.
Anyone have any ideas how to compress the items list?!
User | RANK |
---|---|
44 | |
43 | |
43 | |
28 | |
21 |
On our Shopify Expert Marketplace, you can find many trusted third party developers and fr...
By Arno Nov 27, 2023You've downloaded the Search & Discovery app from the Shopify App store, and as you're ...
By Skye Nov 8, 2023The year-end shopping season is just around the corner. Is a flash sale on your radar? Are...
By Jasonh Nov 6, 2023