My app is a fulfillment service. We are trying to migrate to the new Fulfillment Orders API.
Currently we create fulfillments once the order is shipped on our end to mark the order as shipped (per the old API).
After we migrate, for new orders, we will be using the new fulfillment order process (eg an order is paid, and fulfillment is requested, we accept it, then fulfill it).
However for already existing orders, since the fulfillment request+acceptance has not happened. Since the old fulfillment calls will be deprecated, I believe we will not be able to mark orders as fulfilled unless they are requested+accepted.
-
When we turn on the “fulfillment_orders_opt_in” flag, is each Shopify store that our app has connected to going to automatically request fulfillment and then we have to accept each order that we have already started fulfilling (eg we have accepted the order on our end)?
-
Or will the stores have to manually request fulfillment for each order?
Please advise on how to handle existing orders that do not have any requested+accepted fulfillment orders yet.
Hi T6developer,
Say, you have orders assigned to your fulfillment service, and now you are migrating to fulfillment_orders_opt_in = true. To fulfill the previously existing orders after you have migrated, you will need to fulfill the fulfillment orders matching them.
The flow you will use for fulfilling these “border zone” fulfillment orders is the same as with any new fulfillment orders your fulfillment service receives after opting-in. Necessary fulfillment orders and fulfillment requests for the “border zone” orders will be created (made available for you) automatically when you opt-in. Once you opt-in, you cannot use the old flow endpoints, but the new flow endpoints will work correctly also for the previously created orders.
-
You accept the fulfillment request with the [fulfillmentOrderAcceptFulfillmentRequest](https://shopify.dev/docs/api/admin-graphql/2023-01/mutations/fulfillmentOrderAcceptFulfillmentRequest) mutation or the equivalent rest endpoint.
-
Then you fulfill the fulfillment order with the [fulfillmentCreateV2](https://shopify.dev/docs/api/admin-graphql/2023-01/mutations/fulfillmentCreateV2) mutation or the equivalent rest endpoint.
Answering your questions:
> When we turn on the “fulfillment_orders_opt_in” flag, is each Shopify store that our app has connected to going to automatically request fulfillment
-
You set “fulfillment_orders_opt_in” for every shop independently. FulfillmenService entity means your app installation to a given shop, not your app as a whole.
-
No fulfillments will be requested automatically at the moment of opting-in. Existing requested fulfillments will be suitable for the new flow. Orders not yet requested for fulfillment will not be possible to fulfill. Merchants would have to request its fulfillments.
> Or will the stores have to manually request fulfillment for each order?
Yes, they do. If the store has “Don’t fulfill any of the order’s line items automatically” setting turned on, they don’t want fulfillment orders to be fulfilled until they request fulfillment manually. If the shop has “Automatically fulfill the order‘s line items” setting turned on, Shopify automatically sends fulfillment requests when new orders are created.
Example:
Let’s say we have a fulfillment service with fulfillment_orders_opt_in = false.
In the shop, there are 2 orders assigned for this fulfillment service location.
- Order 1 consists of a Fulfillment Order 1 with status
open and request_status unsubmitted. Fulfillment service has not yet been asked to fulfill this order.
- Order 2 consists of a Fulfillment Order 2 with status
in_progress and request_status submitted. Fulfillment service has been asked to fulfill this order.
The fulfillment service updates itself to fulfillment_orders_opt_in = true.
- For the Order 1, there is still nothing to do for the fulfillment service. The merchant hasn’t yet asked to fulfill it.
- For the Order 2, it already consists of a fulfillment order assigned to the fulfillment service. The difference here is, unlike calling
**fulfillmentCreate** mutation for this order, now you need to follow fulfillment order-based workflow. First you need to accept the fulfillment order, and you cannot fulfill it straight away without accepting it. Then you fulfill the fulfillment order with [**fulfillmentCreateV2**](https://shopify.dev/docs/api/admin-graphql/2023-01/mutations/fulfillmentCreateV2) mutation. So there is no difference in fulfilling this already existing fulfillment order from fulfilling a new fulfillment order the fulfillment service may receive after opting in.
All the above is true for the apps having **write_assigned_fulfillment_orders** permission, what makes us call this app a fulfillment service.
–
Please follow-up if you have related questions.