Re: How to automatically tag order based on fulfilment location?

Solved

How to automatically tag order based on fulfilment location?

Fed-Graphics
Tourist
8 0 1

Hi, Does someone know how to automatically tag an order based on the fulfilment location? I have looked at all Shopify Flow conditions and can't find something suitable. 

 

Many thanks, 

Alex

Accepted Solution (1)
Lena_808
Tourist
7 1 1

This is an accepted solution.

Hi!

 

I have gotten this to work for me! I'll attach a screenshot of what my flow looks like, I have other parts to it that's more specific to my purposes but I took a screenshot of the basic part to add the "Multi" tag. Hopefully it works for you. Let me know if you have any questions and I'll do my best to help!

 

Screenshot 2024-07-15 at 9.49.41 PM.png

View solution in original post

Replies 19 (19)

G-L
Shopify Staff (Retired)
29 4 10

This template tags an order's Customer based on Order.physicalLocation which might be what you are looking for. 

I found it in the template view of Flow searching for "location".

 

To learn more visit the Shopify Help Center or the Community Blog.

G-L
Shopify Staff (Retired)
29 4 10

I also received another suggestion which is to use https://shopify.dev/api/admin-graphql/2021-10/objects/FulfillmentOrder#field-fulfillmentorder-assign... which might be more appropriate for online orders.

To learn more visit the Shopify Help Center or the Community Blog.

Fed-Graphics
Tourist
8 0 1

Thanks for this but it's not really what I'm after. We have an online store with 2 different locations and sometimes location 1 doesn't have the product so location 2 needs to dispatch it. Based on this, how can Flow automatically tag an order depending on which store needs to dispatch it? I hope this makes sense. 

G-L
Shopify Staff (Retired)
29 4 10

I wonder if this template can help: this implied there is a fulfillment order in existence and you have to create N condition paths for the locations you want to be tagged. 

To learn more visit the Shopify Help Center or the Community Blog.

paulnguyen
Shopify Partner
45 0 3

Hi @Fed-Graphics  May I know why you want to tag order based on fulfillment location? 'Cause I often see merchant mark order by fulfillment status.

paul_n
Shopify Staff
1336 151 305

Just to give a little more clarity to how things work...when an order is created a background job kicks off to assign the lineItems to one or more fulfillment locations. Because the locations are not ready at the time Order Created is fired, this is why you need to use "Order Ready to Fulfill" as the trigger. This trigger fires for each fulfillmentOrder (a set of lineItems assigned to a single location). 

 

As per the template you can then check "fulfillmentOrder / assignedLocation / name" for a location, or use that same variable in the tag action to output the location name to a customer or order tag. 

 

If you need to check inventory for lineItems in the order at a specific location, that is also possible in Flow, but quite a bit more complicated.  If so, please provide more details about what you want to have happen. 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Lena_808
Tourist
7 1 1

Hi Paul_n!

 

Came across this thread and found it super helpful! I was able to get my orders tagged by fulfillment location but have now run into another issue. We have 4 different locations and I'm trying to add a "Multi" tag to an order if the order has items being fulfilled from more than one location. I've created flows that say "if fulfillment order assigned location is 1 and 2 then add a Multi tag", "if fulfillment order assigned location is 1 and 3...", "if fulfillment order location assigned is 1 and 4...", "if fulfillment order assigned location is 2 and 3...", and so on to cover all scenarios. So far I haven't been able to get the "Multi" tag added and I'm thinking it could be because when the flow starts, it looks at each line item in the order so it'll pass for one criteria but fail for the next since one single item can only be fulfilled from one location (if that makes sense). Can you think of a way I can get the flow logic to look at all items in the order and check all of their fulfillment locations so that I can add that "Multi" tag? I need that to filter off of for another platform we will be using. Any help would be much appreciated!

paul_n
Shopify Staff
1336 151 305

Personally, I would use the Run code task instead as you can do all of that in one task, and it would handle if you opened another location in the future.

 

What trigger are you using? How are you accessing the locations in your conditions?

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Lena_808
Tourist
7 1 1

I'm triggering off of Order ready to fulfill and grabbing the location by fulfillmentOrder.assignedLocation.name. However, once the workflow is triggered, it checks one item against both conditions I have set (fulfillment location is a and b then add tag) but I'd like it to check all fulfillment locations for the order instead of by item. Is that possible with the workflows? Or do you think using the Run code would be best?

paul_n
Shopify Staff
1336 151 305

That trigger runs per fulfillment order so you will run that logic multiple times per order (not necessarily bad but something to watch out for). 

 

You could use order created -> wait 5 minutes to give fulfillment orders time to be populated.  

 

I would use Run code to check for the number of fulfillment locations, unless you can assume each fulfillment order is different. If so, you could just count the number of `order / fulfillment orders` with a count step. 

 

I'm not sure what line item logic you are referring to, but if you wanted logic for the order / lineItems, this would be a better approach too.

 

 

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Lena_808
Tourist
7 1 1

Can you take a look at this workflow set up I have currently? I've edited this so many times and I'm not sure really what to do next. I'm no coder but if you think using Run code would work best then I'll look into that. 

Screenshot 2024-04-16 at 7.51.41 AM.jpg

paul_n
Shopify Staff
1336 151 305

A fulfillment is a shipment. You want fulfillment order / assigned location / id to check the location. Use the ID field and you'll get a picker to choose the location

Paul_N | Flow Product Manager @ Shopify
- Finding Flow useful? Leave us a review
- Need Flow help? Check out our help docs.
- Building for Flow? Check out Flow's dev docs.
Lena_808
Tourist
7 1 1

Thank you for catching that! I will make that change on all of my workflows now and hope it works! 🙂

Nina_R
Visitor
1 0 0

Hi Lena, did it work? Tried the same but so far can not get it working correctly. 

Lena_808
Tourist
7 1 1

This is an accepted solution.

Hi!

 

I have gotten this to work for me! I'll attach a screenshot of what my flow looks like, I have other parts to it that's more specific to my purposes but I took a screenshot of the basic part to add the "Multi" tag. Hopefully it works for you. Let me know if you have any questions and I'll do my best to help!

 

Screenshot 2024-07-15 at 9.49.41 PM.png

ArianArian
Visitor
2 0 0

Hello, could you please share the whole workflow, Thankyou. 

Lena_808
Tourist
7 1 1

Hi!

 

The rest of my workflow are specific steps for my purposes, which is removing certain tags (naming specific to our business and locations). What I had attached before is the actual workflow that I use to add the Multi tag. After the "check if count is great than 1" then I have the "add order tag" step to add the "Multi" tag to the order. Hope that helps!

ArianArian
Visitor
2 0 0

Hello, 😄 
I actually did this, and it worked so thx for ur help 🙂

ArianArian_0-1722406308201.png

 

Lena_808
Tourist
7 1 1

Yay! So glad you got yours working! 🙂