Insert

Topic summary

Issue: Building an XML payload in Shopify Flow’s HTTP POST to include all order line items (e.g., sku, quantity, weight, title) for a shipping label service. The author can access values in a Flow “For each” loop (verified via logs) but doesn’t know how to inject multiple products into the … section.

Key context:

  • Environment: Shopify Flow
  • Tools/terms: Liquid (Shopify’s templating language), HTTP POST action, XML payload
  • Fields shown in logs: sku, quantity, totalWeight, title, etc.

Suggested approaches:

  • Use a Liquid loop directly inside the HTTP POST body to render repeated blocks for each order.line_item.
  • Alternatively, use a “Run code” action to assemble the XML via JavaScript and pass the prepared string to the POST.

Status/outcome:

  • No final solution or code sample confirmed; guidance provided but unresolved/ongoing.
  • The code snippet (XML/Liquid) is central to understanding; no media involved.
Summarized with AI on December 10. AI used: gpt-5.

I’m trying to use Flow to create shipping labels for a service i use. Shipping label need the orders products with specific values.

I can use For each loop, item in order.lineitems to get these values. Tested with log output.

But, how do i inject this when using HTTP POST in the xml?

This is my log output for loop

<name>{{lineItemsForeachitem.sku}}</name><quantity>{{lineItemsForeachitem.quantity}}</quantity><weight>{{lineItemsForeachitem.contract.originOrder.totalWeight}}</weight><length>0</length><width>0</width><height>0</height><description>{{lineItemsForeachitem.title}}</description><unit_price>

I want to inject product(s) HERE

<OrderSpecification><shipping_product_id>84</shipping_product_id><reference>{{order.name}}</reference><commodities><commodity> INJECT HERE </commodity></commodities><parcels><parcel></parcel></parcels><address_to><street_address_1>{{order.shippingAddress.address1}}</street_address_1><postal_code>{{order.shippingAddress.zip}}</postal_code><residential>1</residential></address_to><recipient><name_to>{{order.shippingAddress.name}}</name_to><mobile_to>{{order.shippingAddress.phone | replace: "+46", "0"}}</mobile_to><email_to>{% for fulfillmentOrders_item in order.fulfillmentOrders %} {{fulfillmentOrders_item.destination.email}} {% endfor %}</email_to></recipient><booking></booking></OrderSpecification>

You need to use Liquid loop inside your “HTTP post” action instead of using a “Loop” action.
Or use a “Run code” action to process and prepare your data with JS.