How do I add a column for each line item specifying its position in the order in my CSV order export?

We have a special field called {{ line_items._index }} that can be used in the Custom Fields or Calculated Fields sections in the Data Settings of order exports.

So for example, if an order has 3 line items and you'd like a custom column showing the position of each line item in each order, using this field would display something like this in the CSV file:

Lineitem Position, Lineitem SKU, Order Number
0, sku1, 12345
1, sku2, 12345
2, sku3, 12345
0, sku1, 123456
1, sku2, 123456

Note that the index starts at 0, so if you want the count to start at 1, simply use a formula like this in the Calculated Fields section:

{{ line_items._index }} + 1

Related Articles:


App: EZ Exporter

Tags: fields, advanced features