We need to import orders (for historical purposes) into Shopify. According to the documentation this is possible via the REST API. Although we’ve been able to create/import orders - its unclear whether functinality is missing, or we are not doing something right - but how are orders will multiple fulfillments handled? Only 1 fulfillment order is created, there is no way to create fulfillment orders, and the fulfillment/order thing seems like a real mess. We need to be able to create an order and create multiple fulfillments on it, to properly represent the order from the other system. Is this possible?
Yes, it is possible to create an order with multiple fulfillments in Shopify API. Although, you can’t directly create fulfillment orders, you can create fulfillments, which are automatically attached to a related order and then fulfillment orders are created based on these fulfillments.
Here are the general steps you should follow:
Create an order using the Order API. Make sure to include line items in the order.
For each fulfillment, use the Fulfillment API to create a fulfillment. In the line_items field, specify the IDs and quantities of the line items that are fulfilled.
Remember that each fulfillment should correspond to a separate shipment. So if an order was shipped in multiple packages at different times, you would create multiple fulfillments.
After creating fulfillments, Shopify automatically creates corresponding fulfillment orders.
Here is an example of how to create a fulfillment:
Remember to replace {order_id} with the ID of the order you’re fulfilling. This will create a fulfillment and the corresponding fulfillment order. Then you can repeat this step for each separate shipment.