Open dooferorg opened 3 months ago
Hey! I see you found the InventoryItem info. Quick question, are you querying using the GraphQL API or with the rest API? I believe the price info has indeed moved for the graph API, but at the moment it's still available on the ProductVariant class via the rest api: link. Your query the product using ShopifySharp's ProductServive, and then loop through each of the variants on the product to check the price.
Note the product API is deprecated for rest though, so eventually you'll have to use graphql.
To be honest, I am not certain what ShopifySharp uses (I'm using the latest nuget project). I did not see any reference to inventory under the ProductVariant class I have in the solution here. I started tinkering with GraphQL but since this project seems cool I thought I'd give it a go today and it's helping me make progress.
For completeness, I was able to determine what I needed via this:
var filter = new InventoryItemListFilter();
filter.Ids = shopifyProd.Variants.Select(x => (long)x.InventoryItemId).ToList();
var inventoryList = inventoryService.ListAsync(filter).Result;
Noting that the list of ids is from the ProductVariant InventoryItemId , then the list of items was returned and can be matched up with what I gathered previously. Worked fine.
Edited: Actually yes, using the GraphQL URL. Since I was tinkering with that way, that was the URL that is being passed to ShopifySharp. I had overlooked changing it.
Awesome! Glad you got it working. I'm in the middle of some maintenance PRs to improve performance of the current GraphService in ShopifySharp and fix up some bugs, but after that I'm planning on doing some major work around making graphql a first-class citizen. It's pretty difficult to use right now (partly because I don't have much documentation for it), but improvements are definitely planned.
If you have any feedback for graphql improvements, or any other questions/problems just let me know!
In gathering data from the Shopify API via ShopifySharp, there seems to be nowhere where the cost for the product or variant is returned. I would like this data since I am writing something to monitor product cost, shipping, margins and adjust prices accordingly.
Am I missing where that might be? I am looking at the ProductVariant object and not seeing it, nor have I found any other way to get that information.
So this might not be an 'issue' with ShopifySharp, maybe just what is available via the API and that I don't know where to look.
Help appreciated, thank you.
ETA: right AFTER I posted this, I found that what I'm looking for may be in the 'InventoryItem' object. Curiously on the Wiki there is no mention of InventoryItem and how to query it via ShopifySharp