New Workflow for fulfilmentOrders with Tracking Information

Topic summary

Main issue: how to add tracking info using the new Fulfillment Orders workflow after the legacy order→fulfillment flow was deprecated.

Current approach (consensus):

  • Fetch fulfillment orders for an order: GET /admin/api/2023-01/orders/{order_id}/fulfillment_orders.json (per-location groupings of line items).
  • Create the shipment with tracking: POST /admin/api/2023-01/fulfillments.json using fulfillment_order_id and fulfillment_order_line_items in line_items_by_fulfillment_order, plus tracking_info and notify_customer.

Key requirements and pitfalls:

  • Scopes: ensure read/write_merchant_managed_fulfillment_orders (and read/write_fulfillments). Missing this scope caused empty fulfillment_orders responses. Assigned_fulfillment_orders endpoints require a Fulfillment Service; most don’t need one.
  • Endpoints: include .json; do not POST to /orders/{id}/fulfillment_orders to create a fulfillment. Use the fulfillment resource.
  • Errors seen: empty {“fulfillment_orders”:} can be misleading (order may not exist or scopes missing). Browser calls can show {“errors”:“The api_client does not have the required permission(s).”} due to the logged-in user, not the app. “expected Hash to be a Array” indicates malformed JSON (line_items_by_fulfillment_order must be an array).

Status: Resolved for most by adding Merchant-managed Fulfillment scopes and using the correct fulfillment POST. One user still needed to fix JSON structure.

Summarized with AI on January 24. AI used: gpt-5.

Ah ha! Thank you! That - almost - worked! It finally returned something:

Array
(
[errors] => Array
(
[line_items_by_fulfillment_order] => expected Hash to be a Array
)

)

Which makes no sense to me…