I'm trying to send a request to Shopify with fulfillment details on an order (i.e. telling the API that an order is fulfilled and what hte tracking details are.)
I'm using the example code from the Dev API docs, as follows:
<?php
use Shopify\Clients\Rest; $accessToken = "xxxxxx";
$client = new Rest("xxx.myshopify.com", $accessToken);
$response = $client->post(
"fulfillments", [ "fulfillment" => [ "message" => "The package was shipped this morning.", "notify_customer" => false, "tracking_info" => [ "number" => 1562678, "url" => "https://www.my-shipping-company.com", "company" => "my-shipping-company" ], "line_items_by_fulfillment_order" => [ "fulfillment_order_id" => 4065174126789, "fulfillment_order_line_items" => [ "id" => 6695635255493, "quantity" => 1 ] ] ] ] );
When I run my script the following error is reported:
[08-Oct-2021 19:54:54 UTC] PHP Fatal error: Uncaught Error: Call to a member function client() on null in /home/.../vendor/shopify/shopify-api/src/Clients/Http.php:164
Stack trace:
#0 /home/.../vendor/shopify/shopify-api/src/Clients/Rest.php(48): Shopify\Clients\Http->request('admin/api//fulf...', 'POST', Array, Array, Array, NULL, 'application/jso...')
#1 /home/.../vendor/shopify/shopify-api/src/Clients/Http.php(74): Shopify\Clients\Rest->request('fulfillments', 'POST', Array, Array, Array, NULL, 'application/jso...')
#2 /home/.../app2/test.php(14): Shopify\Clients\Http->post('fulfillments', Array)
#3 {main} thrown in /home/.../vendor/shopify/shopify-api/src/Clients/Http.php on line 164