I’ve spent hours reading the migration guide, docs, forum posts, and more, and I’m hardly closer to understanding how to properly migrate to fulfillment orders for API v2022-07 than when I started. We don’t seem to fully fit any of the models described, and much of the information is unclear or lacking in enough detail. I’m sincerely hoping that someone can provide some specific guidance for our scenarios.
Overview
Our system sits in between a “wholesale” Shopify store and many client Shopify stores. It gets inventory values from the wholesale store and updates client Shopify stores. It also get orders from the client Shopify stores and creates analogous orders on the wholesale store for fulfillment. When an order is fulfilled on the wholesale store, the system pushes the fulfillment info (tracking, etc.) back to the source client store and marks the appropriate order line items as fulfilled. All this is accomplished with a custom/private app between our system and the wholesale store, and a published (unlisted) app that is installed by all client stores.
Workflow 1 - Receive & Store Wholesale Fulfillment Info
Step one in the process is to receive and persist wholesale fulfillment info, which will then be pushed in the next workflow to the analogous order on the client store that placed the order. Our wholesale store private app has registered the fulfillments/create webhook. When an order’s line items are fulfilled, we get the webhook payload and save it in our database. The structure of this data is a fulfillments table and a fulfillment_line_items table with foreign key linking it to the fulfillments table. These two tables essentially represent the Shopify Fulfillments resource from the perspective of the wholesale store, where the fulfillments table primarily stores the shopify fulfillment ID and tracking info, and the fulfillment_line_items table stores the internal ID for the line item and the quantity that was fulfilled.
Migration Questions:
- Can (should) we continue to use the fulfillments/create webhook to get fulfillment notifications from wholesale? Even the latest API version still includes this webhook topic, so it doesn’t appear to be deprecated.
- Since we don’t directly manipulate fulfillments on the wholesale store (just receive/read data), is there any reason we’d need to get the FulfillmentOrder ID and/or other FulfillmentOrder information for the each wholesale order Fulfillment?
- Correct me if I’m wrong, but neither the fulfillments/create payload nor the Fulfillments resource via the REST API include the ID of the parent FulfillmentOrder resource. It seems like if that’s needed we’d have to do a GraphQL query to get FulfillmentOrder info for the related Order whenever a Fulfilment was created.
- For one-off purposes (such as reconciling fulfillment info), we sometimes also use the REST API
[GET] /orders/{order_id}/fulfillmentsendpoint to get all fulfillment data for a particular Order. This doesn’t seem to be deprecated as of 2023-04. Is there any reason we shouldn’t continue to use this? - Generally, how does our current process for this first workflow need to be modified, if at all, to support the new FulfillmentOrders paradigm?
Workflow 2 - Send Fulfillment Info to Client Stores
With the wholesale order fulfillment information stored, we now need to push the fulfillment data back to the store that originally placed the order. This is done via the REST API’s [POST] /orders/{order_id}/fulfillments endpoint. We then take the response data and save it to our database. The structure of this data is essentially the same as wholesale order fulfillments, except that there’s a different shop_fulfillments table for the main Fulfillment record. Since the wholesale order and client store orders are analogous, at least for our purposes, the original fulfillment_line_items table from workflow 1 also includes a foreign key to this shop_fulfillments table. So, these two tables together represent a Fulfillment resource, but from the perspective of the client store. All of this info is saved internally because our client stores may log into our system directly to perform various actions and view data, such as their orders and order fulfillment statuses.
Migration Questions:
- The
[POST] orders/{order_id}/fulfillmentsendpoint has been deprecated. It appears that the[POST] /fulfillmentsendpoint is the closest replacement for this action. Is this the best method? - The
[POST] /fulfillmentsendpoint requires passing fulfilled line items by FulfillmentOrderID. At what point is a FulfillmentOrder created? Who creates it and how? - Depending on the answer to the 2nd question, which one of the following two methods is correct? (Or is there an entirely different process that should be followed?)
- In order to accomplish the same goal of setting fulfillment info on an order (by line items), it appears that we’d have to first query to get all of the FulfillmentOrders for a give client store order, filter by line items to make sure we have the correct FulfillmentOrder(s), then use those IDs to post a fulfillment (per question 2) to the correct FulfillmentOrder resource(s).
- -OR- Do we create the FulfillmentOrder first, THEN post a fulfillment to it?
- Generally, and if my questions are not on the right track, how does our current process for this second workflow need to be modified to support the new FulfillmentOrders paradigm?
Conclusion & Final Questions
I’m not even sure if I’m asking the right questions because there is still gap in my understanding of FulfillmentOrders and what aspects of fulfillments are being replaced by fulfillment orders. There are other aspects of the migration that are discussed in various documents and articles that I’m not even sure how or if they apply. My main, remaining questions/concerns are:
- Future Proofing: I see that starting in API v2023-01 there are a bunch of fulfillment_orders/* webhook topics. Will it be necessary to transition to those (instead of continuing to use the fulfillments/create topic) in the future? And, if so, should I do something differently in my 2022-07 migration to prepare for that now?
- In regard to the fulfillment_orders/* webhook topics, I think I understand that this would provide us with more granular eventing information for fulfillments, but I’m struggling to see a single fulfillment_orders webhook topic that serves the same purpose as the fulfillments/create (with status of ‘success’) webhook. Which fulfillment_orders/* topic says “this was fulfilled”? Or are these meant to be used in conjunction with, and not a replacement for, the fulfillments/create topic?
- Permissions: There seems to be several different permissions that may or may not be needed depending on what “type of app” you are. I’m not sure that we fit exactly into any of these “types” of apps. There’s [read/write]_merchant_managed_fulfillment_orders, [read/write]_third_party_fulfillment_orders, and [read/write]_assigned_fulfillment_orders. My guess is that we need [read/write]_merchange_managed_fulfillment_orders, but maybe assigned_fulfillment_orders works too?
- Note: Unfortunately, we currently only have access scope permissions relating to products, orders, locations, and inventory – no [read/write]_fulfillments. However, up to this point, we’ve still been able use endpoints related to fulfillment. After some testing, and per docs, we can’t request granular access scopes for [read/write]_assigned_fulfillment_orders permissions without the [read/write]_fulfillments permission. However, we CAN request granular access scopes for the [read/write]_merchant_managed_fulfillment_orders permissions. Hopefully that’s what we need!
- Fulfillment Service: I read in the migration guide (and other places) that you need to “opt in to fulfillment orders as a fulfillment service,” but its very unclear if this is a general requirement, or only a requirement if your app was registered as a fulfillment service, which ours isn’t. If its a general requirement, then my workflow 1 will need to change and I’ll somehow need to register a callback URL. Before I dive down this rabbit hole, since we’re not registered as a fulfillment service do I need to worry about this? Or is step 3 (and step 4) in the migration guide only for apps that registered as a fulfillment service? (In which case, this should really be made more clear.)
A huge thank you to anyone who is willing to answer any of my questions. Or, if skipping the bulk of my questions and just cutting to the chase based on my described workflows and goals makes more sense, that’s great too. Either way, drinks are on me.