Fulfillment_orders.json returning me null

Hi to all Dev, :wink:

I’m currently working on an app functionality where merchants can provide a tracking number and carrier for each order or even at the line item level.

According to the Shopify docs, fulfillment_orders are supposed to be auto-generated. However, when I try to create a fulfillment, I see that I also need a fulfillment_order_id. The issue is that whenever I try to fetch fulfillment_orders, I get null (no data at all).

I’m new to Shopify and still trying to understand how this works, so I’m not sure if I’m missing a setup step or if something else is required before fulfillment_orders get created.

Could anyone please clarify:

  • When exactly are fulfillment_orders generated?

  • Is there something specific I need to configure (e.g., locations, inventory, order type) before I can fetch them?

  • How should I correctly link the tracking number and carrier to the order/line items through the fulfillment process?

Any guidance or example would be really helpful.

Thanks in advance!

private function createFulfillment(User $user, Order $order): void

{

    $numericOrderId = str_replace('gid://shopify/Order/', '', $order->shopify_order_id);

    $fulfillmentData = \[

        'fulfillment' => \[

            'line_items' => $this->prepareLineItems($order),

            'tracking_number' => $this->orderData\['tracking_number'\] ?? null,

            'tracking_company' => $this->orderData\['carrier'\] ?? null,

            'notify_customer' => $this->orderData\['sendNotification'\] ?? true

        \]

    \];

    $response = $user->api()->rest('POST', "/admin/api/2025-07/orders/{$numericOrderId}/fulfillments.json", $fulfillmentData);

    if ($response\['status'\] === 201) {

        $this->storeFulfillmentInDatabase($order, $response\['body'\]\['fulfillment'\]);

    } else {

        Log::info(json_encode($numericOrderId));

        Log::info(json_encode($fulfillmentData));

        Log::info(json_encode($response, JSON_PRETTY_PRINT));

    }    

}

and here is the Log ,for a better understanding , . .

[2025-10-01 12:29:30] local.INFO: “6747969061181”

[2025-10-01 12:29:30] local.INFO: {“fulfillment”:{“line_items”:[{“id”:16629000110397,“quantity”:1}],“tracking_number”:“123456781234567”,“tracking_company”:“Apple Express”,“notify_customer”:true}}

[2025-10-01 12:29:30] local.INFO: {

"errors": true,

"response": {},

"status": 406,

"body": null,

"link": null,

"exception": {},

"timestamps": \[

    1759321769320337

\]

}

Can you try with the graphql apis? I suspect part of this might be using legacy apis

The docs for order management apps covers some of the logic about when fulfillment orders are created Apps in order management

1 Like