Question

XML Line Items

  • 7 October 2020
  • 2 replies
  • 305 views

Userlevel 1

Hi all,

The XML we are need to send has nested line items and the source data sends line items as a list. We can use formatter (Utilities > Line Itemizer) to separate them out but we are struggling to implement them in the nest format required because it seems not all actions support Zapier's line items functionality.

Our XML needs to follow this rough structure:

<ITEM>
<SKU>2345</SKU>
<QTY>3</QTY>
<Price>200</Price>
<LineNumber>1</LineNumber>
</ITEM>

<ITEM>
<SKU>1235</SKU>
<QTY>2</QTY>
<Price>300</Price>
<LineNumber>2</LineNumber>
</ITEM>

<ITEM>
<SKU>1555</SKU>
<QTY>2</QTY>
<Price>400</Price>
<LineNumber>3</LineNumber>
</ITEM>

At the moment, all we are able to do is:

<ITEM>
<SKU>2345, 1235, 1555</SKU>
<QTY>3, 2, 2</QTY>
<Price>200, 300, 400 </Price>
<LineNumber>1, 2, 3</LineNumber>
</ITEM>

Any ideas how we might achieve this?


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

2 replies

Userlevel 7
Badge +11

Hi @Squircle!

Would you be able to elaborate a bit on what your overall workflow looks like? What’s the trigger and what’s the action? Just trying to make sure we can get an accurate picture of what the whole process would entail here so we can get you an answer :)

Thanks!

Userlevel 1
  1. A Woocommerce order is placed.
  2. The output needs to be an XML doc in a specific format for a large distribution company
  3. If the trigger is per line item, it triggers for each line item, which isn’t what we want.
  4. We simply want the trigger to be on “order paid” but include a section in the XML that splits each line item from the order into this format:
    <ITEM>
    <SKU>2345</SKU>
    <QTY>3</QTY>
    <Price>200</Price>
    <LineNumber>1</LineNumber>
    </ITEM>

    <ITEM>
    <SKU>1235</SKU>
    <QTY>2</QTY>
    <Price>300</Price>
    <LineNumber>2</LineNumber>
    </ITEM>

    <ITEM>
    <SKU>1555</SKU>
    <QTY>2</QTY>
    <Price>400</Price>
    <LineNumber>3</LineNumber>
    </ITEM>
  5. So, a new <ITEM> for each line item to be included in a single order
  6. We then are currently using “Create File from Text” to create the XML file.
  7. Any help would be much appreciated!