Yes, you can easily sort the products in the Order Printer Pro templates.
You can sort them by SKU, vendor, title, quantity or others. You'll need a small piece of code, so you'll have to decide which sorting type you'll create:
Sort Type | Snippet |
SKU | {% assign line_items = order.line_items | sort: "sku" %} |
Title | {% assign line_items = order.line_items | sort: "title" %} |
Vendor | {% assign line_items = order.line_items | sort: "vendor" %} |
Weight | {% assign line_items = order.line_items | sort: "weight" %} |
Quantity | {% assign line_items = order.line_items | sort: "quantity" %} |
NOTE: If you're planning to change the sorting order, e.g. sort weight from higher to lower, you could achieve it by adding reverse
to the snippet. As in:
β{% assign line_items = line_items | sort: "weight" % | reverse %}
Once you're ready to sort the products in the templates, please do the following:
Go to the Manage Templates page in Order Printer Pro
Click the "Edit template" button next to the template you would like to edit
You will then find the template code in the "Code" tab on the Edit template page
Just drop the chosen snippet from the table above at the very top of the template code:β
Once you are done making changes, click the "Save" button.
Please check that there are no reassignments of the line_items
in the order by searching for:
β{% assign line_items
If you find any, please add the sorting line right after the existing line_items
assignment, instead of at the very top of the template.
Done! Now your templates will sort your products according to your preference!