phpclassic / php-shopify

PHP SDK for Shopify API
Apache License 2.0
568 stars 211 forks source link

Version 1.1.23 - change to 2202-07 version breaks fulfillments #264

Closed jeroendelau closed 1 year ago

jeroendelau commented 1 year ago

In version 1.1.23 the Shopify version was updated from 2022-01 to 2022-07. There are some breaking changes between these versions.

This now results in 404 NOT found: $client->Order($order->Order_ID)->Fulfillment->post($body);

200: admin/api/2022-01/orders/{order_id}/fulfillments.json
404: admin/api/2022-07/orders/{order_id}/fulfillments.json

Instead now you will have to send to a different location, with an entirely different payload. admin/api/2022-07/fulfillments.json

I believe what would be needed is $client->Fulfillments

And remove $client->Order($order->Order_ID)->Fulfillment

For others with the same problem, I have fixed my version to 1.1.22

whobutsb commented 1 year ago

Does your app have scope permissions for: write_assigned_fulfillment_orders, read_assigned_fulfillment_orders. read_fulfillments, write_fulfillments?

JoeKuhns commented 1 year ago

I'm having the same issue and am not following you on your fix. Can you clue me in a little?

Thanks.

Update, I do have scope permissions as noted above.

jeroendelau commented 1 year ago

No, I only request: write_fulfillments (and a bunch of others, but not fulfillments)

Fairly confident that I would receive a 403 if the scope was invalid, not a 404 that returned now. The SDK is trying to call a route that doesn't exists in api version 2022-07.

IMHO - this is a breaking change and should have been released as minor version release. 1.1.x - release another minor release reverting to 2022-01 1.2.x - bump the shopify api version to 2022-07

@JoeKuhns I updated composer.json to fix the library to 1.1.22, the last one that uses api version 2022-01

// in composer.json update
...
 "phpclassic/php-shopify": "1.1.22",
...

// run 
composer update phpclassic/php-shopify
JoeKuhns commented 1 year ago

@jeroendelau Excellent thanks! how did I not know composer would downgrade? Works perfectly.

tareqtms commented 1 year ago

@jeroendelau I have fixed the releases as you suggested. However, For everyone's info, it's best to use a self-defined API Version in the $config array. Like this:

$config = array(
    'ShopUrl' => 'yourshop.myshopify.com',
    'AccessToken' => '***ACCESS-TOKEN-FOR-THIRD-PARTY-APP***',
    'ApiVersion' => '2022-07',
);

This will give you better control over the API Versions. Anyhow you will need to keep updating the API Version, because versions will reach EOL after some time.

jeroendelau commented 1 year ago

@tareqtms, many thanks!

I'll start work somewhere next week to help fix the fulfillment for the 2022-07 version.

damix1984 commented 1 year ago

Is there any news for the fix on the fulfillment for 2022-07 version? Is someone working on it coming with a solution in few time?

whobutsb commented 1 year ago

A couple pieces of news from Shopify. Apps will have until 2023-07 release to migrate to the new version.

Legacy Fulfillment API Deprecation

Fulfillment orders migration guide