[Flow] Update add/remove tag from a different order when a new order is created

[Flow] Update add/remove tag from a different order when a new order is created

Tengoku
Visitor
2 0 0

I am trying to figure out a way to add/remove tags from a specific order made by the customer when they have submitted a new order.

 

Context:

I'm giving my customers the option to add extras to their order. In case customers have didn't opt-in for that, I would still like to send them an email before the order goes into production to try and 'upsell' the extras once more - the customer is basically sent an email with a permalink with only the 'extras' on the checkout page and a property with the value of the original order id.

 

I have already managed to do all of this with Flow - however, I'm now stuck at trying to update the original order in case the customer decides to add the extras.

 

What I have done so far is:

- Trigger when a new order is created > Check if the order only has the 'extras' > 

 

What I would need to do next is:

- Get the "main" order by using the 'order_id' value in the 'extras' order;

- Add a 'with-extras' tag to the "main" order (and remove the 'standard' tag);

 

I'm not even sure if this is something that can be done with Flow so I figured I'd come here for help.

 

Thanks in advance.

Replies 3 (3)

paul_n
Shopify Staff
1295 148 297

Have you looked at using a "Get order data" action? I don't think you can query by ID, but you can by customer and other values like a tag.

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.
Tengoku
Visitor
2 0 0

Yea, I was looking exactly at this action but what I'm unsure of is - when getting the order data, isn't this just a readable object? If I get the order data from that first order within the flow for this new order, how would I then change the original one?

paul_n
Shopify Staff
1295 148 297

Assuming you get 2 orders back, you could check if the order id returned by "Get order data" matches the order from the trigger.

 

Something like;

  • Trigger
  • <workflow logic>
  • Get order data
  • For each (get order data)
    • if foreach_order.id != order.id
      • Add tag
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.