Shopify Api fulfillment_order_notification only triggered once

Solved

Shopify Api fulfillment_order_notification only triggered once

mxxm
Shopify Partner
13 0 3

Hi guys,

 

I am currently working with the setup of a fulfillment app. The issue I have is that after a fulfillment request has been triggered by a merchant, my endpoint, built like described in the docs: <callback_url>/fulfillment_order_notification is only called once.

 

I am following all the steps of the docs while this issue refers to step 2:

https://shopify.dev/docs/apps/fulfillment/fulfillment-service-apps/manage-fulfillments

 

As soon after I have installed the App, created the first order and requested a fulfillment. But as soon as I create a second order and a second fulfillment request, my endpoint is not triggered anymore.

 

Not sure if I am overseeing something, but I would really appreciate some help with this.

 

Thanks in advance 🙂

Accepted Solutions (2)

jdorsch
Tourist
9 2 5

This is an accepted solution.

I had trouble with this as well and unfortunately the documentation is lacking.  Your app needs to return 200 OK and it needs to return it rather quickly.  If there is any other status returned, or if it takes too long then shopify will not trigger the endpoint again for a number of hours (I think it was either 3 or 6 hours).  I tested this by purposefully returning a 400 then left the app running and logged when it was triggered by shopify and it was like clockwork where if it received on ok status in under around 5 seconds it would trigger again as soon as an order was placed but if there was a different status returned, or if it took long before returning 200 then shopify would not try again for a few hours and just let the orders stack up.,

 

For my purposes this was unacceptable as there is no visibility on that endpoint if shopify had errors or when the next attempt would fire.  We ended up switching that fulfillment URL to a dummy that always returns 200 ok regardless then subscribed to webhooks which have much better visibility within shopify.

 

Another option is to have it return 200 ok regardless and just poll for orders every few minutes.  The webhooks is a more robust solution imo, but it may take a bit longer to implement.

View solution in original post

jdorsch
Tourist
9 2 5

This is an accepted solution.

I believe you want to subscribe to fulfillment_orders/fulfillment_request_submitted.  Depending on how a store is configured a fulfillment request may be submitted manually at a later point, or the fulfillment order may not be immediately available when an order is created.  Secondly, editing an order can result in an additional fulfillment request being submitted.  You also want to handle the cancel requests as that is part of the whole flow.

View solution in original post

Replies 8 (8)

mxxm
Shopify Partner
13 0 3

Is no one having an approach on this?

jdorsch
Tourist
9 2 5

This is an accepted solution.

I had trouble with this as well and unfortunately the documentation is lacking.  Your app needs to return 200 OK and it needs to return it rather quickly.  If there is any other status returned, or if it takes too long then shopify will not trigger the endpoint again for a number of hours (I think it was either 3 or 6 hours).  I tested this by purposefully returning a 400 then left the app running and logged when it was triggered by shopify and it was like clockwork where if it received on ok status in under around 5 seconds it would trigger again as soon as an order was placed but if there was a different status returned, or if it took long before returning 200 then shopify would not try again for a few hours and just let the orders stack up.,

 

For my purposes this was unacceptable as there is no visibility on that endpoint if shopify had errors or when the next attempt would fire.  We ended up switching that fulfillment URL to a dummy that always returns 200 ok regardless then subscribed to webhooks which have much better visibility within shopify.

 

Another option is to have it return 200 ok regardless and just poll for orders every few minutes.  The webhooks is a more robust solution imo, but it may take a bit longer to implement.

mxxm
Shopify Partner
13 0 3

Thanks a lot for your help!!👍 This would have taken me ages to find out!


I was also thinking about using the webhook. But I didn't find a webhook for FULFILLMENT_ORDER_CREATE. So I guess the workaround would be to listen to ORDERS_CREATE webhook and then fetch the fulfillment orders...

jdorsch
Tourist
9 2 5

This is an accepted solution.

I believe you want to subscribe to fulfillment_orders/fulfillment_request_submitted.  Depending on how a store is configured a fulfillment request may be submitted manually at a later point, or the fulfillment order may not be immediately available when an order is created.  Secondly, editing an order can result in an additional fulfillment request being submitted.  You also want to handle the cancel requests as that is part of the whole flow.

mxxm
Shopify Partner
13 0 3

Thanks a lot! You were right, I was searching for the webhook: fulfillment_orders/fulfillment_request_submitted 

 

While testing everything another question in the same context came up. What happens when an order contains fulfillment orders and the merchant updates the shipping address after the order was created. As it seems the fulfillment orders are not updated by this and the destination stays the same. Do I have to subscribe to order/update to receive changes in the shipping address?

 

I hope this is understandable...

jdorsch
Tourist
9 2 5

I am not sure with that, our policy is to not allow address changes.

 

If it is not clear in the documentation, my suggestion is to subscribe to webhooks you think are relevant, make the address change, then see what hooks fire.

maxsym
Shopify Partner
5 0 0

@Shopify is this bug going to be solved? It's still happening

maxsym
Shopify Partner
5 0 0

@Shopify @Richard_L our team will need to heavily rely on this webhook but it has the bug OP reported. When is it going to be fixed?