Skip to main content
Sorting products

Describes how to sort products by SKU, vendor, name, or quantity.

Blanca Gongora avatar
Written by Blanca Gongora
Updated over 5 months ago

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:

  1. Go to the Manage Templates page in Order Printer Pro

  2. Click the "Edit template" button next to the template you would like to edit

  3. You will then find the template code in the "Code" tab on the Edit template page

  4. Just drop the chosen snippet from the table above at the very top of the template code:
    ​
    ​
    ​

  5. Once you are done making changes, click the "Save" button.

Done! Now your templates will sort your products according to your preference!

Did this answer your question?