How to automate order fulfillment using Flow?

Hello, I’m trying to create a flow but keep getting stuck on the best way to do it. This is what I’m trying to do:

When ALL LINE ITEMS from an order, except [Line Item: Product ID], are set to FULFILLED

then

Set ALL LINE ITEMS to FULFILLED

Is this possible? I’m new to Flow and have only made a few simple automations. Happy to use the REST API if it’s the best way.

Thanks, M

Try to set the Flow up this way:

  1. Trigger

    • Choose Order Updated.
  2. Conditions

    • Add condition: If All of the following conditions are true
      • Line item status > is > fulfilled.
      • Line item - Product ID > is not > [Line Item: Product ID].

    Note: You’ll have to loop through all line items to check this condition. Shopify Flow supports “For each line item in order” to iterate over line items and run checks on each of them.

  3. Actions

    • Add action: Order > Update line items.
      • Set Line item status to fulfilled for all line items.

Hi No_robotocha,

You’ll want to look at using the Fulfillment Event Created trigger, then you an look at the order’s fulfillments.

In the Condition, you can write the check for the Product ID using order.fulfillments.fufillmentLineItems.lineItem.product.id, then add a sub-condition on the loop that iterates through fulfillments to check status. You can adjust the All/Any/None logic and adjust the test to suit your exact use case:

  • All of Order / Fulfillments
    • All of Fulfillment line items
      • fulfillmentLineItems_item.lineItem.product.id = YOUR_PRODUCT_GID
    • fulfillments_item.status = SUCCESS

For the status update, Flow does not support that Action so you would need to use the Send HTTP Step (not available on Basic plan) to call the Admin API.

Hope that helps!

Hi Dave,

This is very helpful and seems close to solution. I’ve been trying to recreate and have a couple of follow-up questions:

  • In your image you have All of Order / Fulfillments box, then a All of Fulfillment line items box - how did you do this?
  • I still can’t wrap my head around the logic i.e. if an order contains product x AND all other products in the order are fulfilled THEN set product x to fulfilled
  • We have Shopify Advanced plan, so I’m happy to use the Send HTTP action to solve this

Thanks, M

Hi Zachary,

Thanks for your suggestion. I’m not sure the correct way to loop through through to order contains [Line Item: Product ID] AND all other products in the order are fulfilled THEN set [Line Item: Product ID] to fulfilled.

Do you know how I would do this?

I have also found that it’s not as simple as setting line item status to fulfilled as this is not yet an action, but I can cross that bridge with an HTTP request when I come to it.

Shopify support sent me here, but there are no Order Updated Trigger. What can i do?

Hi @Vitor_Lan - that’s true, there’s more context here.

I assume the potential for infinite loops would be a factor in Order Updated not being available.

A solution to this depends on what you’re trying to do - can you explain?

I’m trying to build a flow that

  • when the order is archived, or receive a note
    → fulfill it and ad the note to the tracking order id + carrier