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?"
Yes it also works for me sorting by title, but like you I want to group the products by product type, with each group being alphabetically sorted within each product type group.
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?!
We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024