Hi all,
I’m running into a strange issue when using Shopify Flow with the Admin API. After updating a draft order’s line items via draftOrderUpdate
, the checkout URL only displays one item, even though the draft order contains multiple line items.
Steps to reproduce:
- Create a Flow triggered by “Draft order created”, and add a “Send Admin API request” action
- In the API request, I’m using
draftOrderUpdate
mutation to add custom attributes to each line item. Here’s the JSON I’m using:
{
"id": "{{draftOrder.id}}",
"input": {
"lineItems": [
{% for line in draftOrder.lineItems %}
{
"customAttributes": [
{
"key": "_custom_id",
"value": "{{ line.id }}"
}
],
"quantity": {{ line.quantity }},
"requiresShipping": true,
"sku": "{{ line.variant.sku }}",
"taxable": true,
"title": "{{ line.title }}",
"variantId": "{{ line.variant.id }}",
"weight": {
"value": {{ line.weight.value }},
"unit": "{{ line.weight.unit }}"
},
"uuid": "{{ line.id }}"
}
{% unless forloop.last %},{% endunless %}
{% endfor %}
]
}
}
- Create a draft order with multiple line items and trigger the Flow (manually or automatically).
- Ensure that Flow has updated the line items
- click “Share” on the draft order to get the checkout URL
- Open the checkout URL, only one item shows in the cart.
Notes:
- If I disable Flow - so the draft order is unedited, the checkout URL shows all items correctly.
Am I doing something wrong or is this a bug?
Any insight would be appreciated. Many thanks!