nozzlegear / ShopifySharp

ShopifySharp is a .NET library that helps developers easily authenticate with and manage Shopify stores.
https://nozzlegear.com/shopify-development-handbook
MIT License
743 stars 309 forks source link

Deprecated "Orders" API - FulfillmentOrders does not take a filter param. #920

Closed tig66208 closed 1 year ago

tig66208 commented 1 year ago

I have a use case where I need to look up an order by the string name and then mark it as fulfilled. I currently do this by using a custom filter to find the order:

MyCustomFilter filter = new MyCustomFilter { Name = name, Limit = 1, Status = "any" };

try { ShopifySharp.Lists.ListResult orders = await service.ListAsync(filter); return orders; } catch(Exception ex) { Console.Write(ex.ToString()); }

However, the Orders API is being deprecated, and FulfillmentOrders does not have a parameter for filters. Anyone have a good workaround?

nozzlegear commented 1 year ago

Hey @tig66208! I think there's been a misunderstanding; the Orders API isn't deprecated, that's the original Fulfillments API which should already be gone by now (or at least they turned it off for one of my clients in early July).

The only thing that has changed with the Orders API is that your app needs approval to use it now, as it's part of the Protected Customer Data policy. I don't think that applies if you're building a private/custom app, though I may be wrong.

tig66208 commented 1 year ago

It's a "custom" app, but was never a legacy private app, but is only deployed to my store. It's flagging me as using a deprecated API, and the documentation it points to is this:

https://shopify.dev/docs/apps/fulfillment/migrate

Which specifically states that Orders will be deprecated. I am not using the deprecated Fulfillments API, just the new FulfillmentOrders, so I believe that Orders is the issue.

nozzlegear commented 1 year ago

That's super strange. Which version of ShopifySharp are you using? And where do you see the warnings/flags for these, could you provide a screenshot? I've seen them before for public apps, but I don't think the interface is the same.

-- Joshua Harms

On Sat, Aug 19, 2023, at 15:26, tig66208 wrote:

It's a "custom" app, but was never a legacy private app, but is only deployed to my store. It's flagging me as using a deprecated API, and the documentation it points to is this:

https://shopify.dev/docs/apps/fulfillment/migrate

Which specifically states that Orders will be deprecated. I am not using the deprecated Fulfillments API, just the new FulfillmentOrders, so I believe that Orders is the issue.

— Reply to this email directly, view it on GitHub https://github.com/nozzlegear/ShopifySharp/issues/920#issuecomment-1685102955, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASOE7AVYBKKXKVA7SHLNIDXWEOO5ANCNFSM6AAAAAA3WC36NE. You are receiving this because you commented.Message ID: @.***>

tig66208 commented 1 year ago

I'm using 5.19.1, here's the warning in the apps section of my store:

image

Now perhaps I'm misunderstanding and we can continue using that, but I need to add the new scopes.

tig66208 commented 1 year ago

I should point out, I'm only using that API so that I can get the Order ID by the "friendly name" and then I call the fulfillment service. This is a webhook implementation, my freight provider is sending me when orders ship, they have the friendly name of the order as a field when we book shipments.

nozzlegear commented 1 year ago

Oh I see, thanks! ShopifySharp v5.19.1 is in fact using a deprecated version of Shopify's API; it's on version 2022-07, whereas the latest version of ShopifySharp is on 2023-07.

There's a bit of confusing terminology here when Shopify says things are deprecated. First, the API version: 2022-07 is deprecated in the sense that they don't support it anymore, and it may stop responding to requests entirely at some point.

Second, the Fulfillments API as it was implemented in 2022-07 and earlier was deprecated and removed entirely in 2022-10. Shopify requires all apps to move to the Fulfillment Orders API instead, which is able to do everything the old Fulfillments API was able to do, plus more.

For your usecase, I think you'll be totally fine migrating to the latest versions of ShopifySharp and thus the latest versions of Shopify's API. The Orders API -- the one for managing orders placed by customers, including searching for orders by name using the custom filter you have -- remains unaffected by any deprecations. The only change to it was the Customer Data Protection stuff I mentioned earlier.

It sounds like you do use the Fulfillments API? If you create fulfillments, then you will need to do a bit of refactoring of your code to adapt to the new Fulfillment Orders API. There's a lot of sample code here in #914, along with some troubleshooting for common issues, that should help with that.

tig66208 commented 1 year ago

Sounds great, I knew I needed to pull the trigger on the updates. Fortunately I'm not using the Fulfillments API, I am using FulfillmentOrders (once I have the order ID I need).

Thanks for the info and help.

nozzlegear commented 1 year ago

No problem! Let me know if you have any trouble upgrading, I'm happy to help.