Solved

Shopify Flow - Optional Order/Customer/Product?

Conjured_Char
Shopify Partner
36 0 4

When creating a trigger that uses the Order property, is there any way to make it optional?

 

image.png

 

We've tried passing null to the order_id or omitting it completely, but Shopify rejects the content with errors like "Required field missing: 'order_id'." and "Type error for field 'order_id':  is not an Order."

 

Does anyone know if there's a way to have an Order (or Customer/Product) property for a flow trigger, but make it optional?

Accepted Solution (1)
paul_n
Shopify Staff
1056 136 249

This is an accepted solution.

Interesting. I would not recommend using a string as you cannot use that yet to get the order in Flow. 

 

One possibility is to create a second trigger that doesn't have the order id field. The downside of that is that merchants would need to implement two workflows for the use case. If the merchants just wanted an attribute on the order (like the order number), you could just send that as a string. 

 

We'll weigh adding the capability to handle null resources for our trigger tasks, but I would not expect it soon enough to implement for this use case. 

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.

View solution in original post

Replies 5 (5)

paul_n
Shopify Staff
1056 136 249

No, if you have the Order field it is required. Flow uses that field to allow merchants to get details about the Order. If it can be null, then it makes it not reliable for use in Flow. 

 

Can you elaborate on why you need to do that?

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.
Conjured_Char
Shopify Partner
36 0 4

Thanks for the quick reply, @paul_n.

 

We have a few use cases, but here is one that is pretty simple. We have an app that handles digital memberships (subscriptions) using Shopify's Subscription API. We have several flow triggers, including one for "Membership Cancelled". We had several merchants request that we include the original order when the membership was first purchased in that trigger. This works perfectly.

 

The problem comes in with merchants for whom we have done an import/migration from a different recurring payment platform (ex: Stripe) into Shopify. For those members, there isn't an original order in Shopify for the membership purchase. If those members cancel before an order is created, there is no valid order ID to send along in the "Membership Cancelled" trigger. These API calls can't go through, and our merchants aren't getting these triggers as expected.

 

Do you have any ideas for how we can work around the requirement? If we changed the order property to a string would the merchants be able to connect it to an order if it existed, or is the Order property the only way for merchants to access the order details?

 

Thanks so much in advance! 

paul_n
Shopify Staff
1056 136 249

This is an accepted solution.

Interesting. I would not recommend using a string as you cannot use that yet to get the order in Flow. 

 

One possibility is to create a second trigger that doesn't have the order id field. The downside of that is that merchants would need to implement two workflows for the use case. If the merchants just wanted an attribute on the order (like the order number), you could just send that as a string. 

 

We'll weigh adding the capability to handle null resources for our trigger tasks, but I would not expect it soon enough to implement for this use case. 

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.
Conjured_Char
Shopify Partner
36 0 4

@paul_n Thanks so much for the reply! Definitely throw my vote in for the ability to have orders and other resources be optional.

dylanpierce
Shopify Partner
215 3 99

Hi @paul_n just adding on another use case.

We help merchants by automating the verification of their customers. Sometimes an ID check is only associated with a customer account, because the verification is triggered by a new user registration on their store.

In that case, there would be no order association.

So the order reference is optional for some use cases, whereas the customer reference will always exist.

So we'll create two separate triggers `Customer verified` and `Order verified` in this current paradigm.

Just giving you some context, hope this helps.

Founder of Real ID - Verify your customer's real IDs easily & securely with modern A.I.

Want to see it in action? Check out our demo store.