Covers all questions related to inventory management, order fulfillment, and shipping.
Have a strange GraphQL Issue. I am querying the Harmonized system code and country of origin on a inventory_item I just updated and am getting null as a return value.
{ inventoryItem(id:"gid://shopify/InventoryItem/41899753144525") { countryCodeOfOrigin harmonizedSystemCode sku
updatedAt
createdAt } }
"data": { "inventoryItem": { "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "sku": "4255OR", "updatedAt": "2023-03-02T08:58:09Z", "createdAt": "2021-07-05T16:30:03Z" } },
Doing the same request to the REST API "/inventory_items/41899753144525.json
Returns the correct information.
This should definitely NOT be happening that there is this kind of difference between the two API's.
Can we have someone look at this ?
Hey @garyrgilbert ,
Thanks for the post!
It's curious you are not getting a result using GraphQL - I just tested your exact same call in my development store and I was able to get the results for both HS Code and Country Of Origin as expected. I wondering if it might be store or permission based but we would need you to go through our Partner Support to get an authenticated look at the store in question.
You can contact Partner Support under "Support" in your partner dashboard and reference this post.
Hope that helps!
KN
Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi There,
Thanks for your reply! It cant be a permissions thing since I have the permissions to run both of the queries otherwise I would receive the appropriate error message indicating the missing scopes.
Oh, I get a result now. I just didn't get a result then... My analysis of the issue leads me to the conclusion that the graphql results are being cached based on the query parameters for a specific duration of time.
Here are the replication Steps:
1) Run the GraphQL query above against an inventory item id that has the HS code defined. Save the result.
2) Execute a GET against inventory_items rest endpoint for the same inventory_item_id. Save the result.
3) Modify the country of origin / hs code for the inventory item id in steps 1 and 2
4) Rerun steps 1 and 2 directly after step 3 and compare. They should be the same.. they are not.
5) choose a different inventory item and enter in new or modify existing origin and hs code
6) run the graphql query from above. The query results will reflect the newly changed data.
7) change the information back to the original values
😎 run the graphql query. The results will be from step 6 e.g. unchanged even though the data has changed.
Caching results for things that don't change frequently is a great way to improve performance. Its just in this situation it kinda sucks.
Cheers,
Gary
Up, the issue still exist now April 2024.
1/ Create Product -> Update HS code / CountryCode etc.
2/ Query Product Variant -> InventoryItem query result got updated
3/ Query InventoryItem by ID -> query result not updated
Please check and fix!!!