Generate Dynamic Lines in EDI File

@fahadmicro You can use the Node, transform nodes entity transformer to loop through the line_items in your Shopify order entity. Inside the node transformer, you can then transform each line item to match the Groups.0.Transactions.0.PO1Loop format.

However, in order to get the index of each line item, before entering the above Node transformer, you should put use the Move data between accessors to map the index of line_items array into an accessible property inside the each line_items object. See the below picture.

The above transformer will result in the below PO1loop array.

{
  "PO1loop": [
    {
      "index": "0", // the index
      "line_item": {
        ...
        "id": 669751112,
        "price": "199.99",
        "product_id": 7513594,
        "quantity": 1,
        "requires_shipping": true,
        "sku": "IPOD-342-N",
        "title": "IPod Nano",
        "variant_id": 4264112,
        "variant_title": "Pink",
        ...
      }
    },
    {
      "index": "1", // the index
      "line_item": {
        ...
        "id": 669751113,
        "price": "199.99",
        "product_id": 7513594,
        "quantity": 1,
        "requires_shipping": true,
        "sku": "IPOD-342-N",
        "title": "IPod Nano",
        "variant_id": 4264112,
        "variant_title": "Pink",
        ...
      }
    }
  ]
}

You can use the Node transformer to loop through the PO1loop array instead of looping through the original line_items array.

1 Like