Hi, I am having a problem to get the Stock of a product. I do:
And I get the response:
However, when i go to the store and see the product (https://krostnewyork.com/products/future-leaders-tee?variant=18548988412017) it is out of stock. Can you help me with this?
Solved! Go to the solution
This is an accepted solution.
If those 2 items are in some cart(s) then you would be faced with out of stock messaging. Shopify takes stock out of inventory to place into carts so just because the JSON shows a 2 does not mean there is actually 2 on the shelf. There could be 2 in a cart so zero on a shelf. Once the cart is abandoned or checkout completes, then that 2 is finalized once again, either as a zero because they were bought, or a 2 again, as the cart was destroyed and the contents were returned to the inventory for others to purchase.
Usually if you want the correct current inventory for a SKU you should use an API call to the InventoryLevel endpoint, providing the variant's inventory_item_id and the location ID it was assigned to. With multilocation inventory, your approach of asking for inventory simply by looking at the quantity from a product call is not terribly accurate anyway.
Sorry to bother again, but I have tried this and it does not seem to work like that.
I added the 2 products to my cart in one session and then asked a friend to enter the same product and they still see the product available, so this shows that it does not work this way (at least from what I could test). Any other idea why this could happen? Or am i missing something here?
I am sorry if I was not clear. The problem is the same. In the response of the API, I get that there are 2 products in the inventory. When I go to the site, I see the product is Out of Stock. I understand what you explained me about the shelf, but I tried this approach to see if that was actually the problem and I could not verify that. What I tried to explain in the last message was HOW I tried to check your answer and failed. Here is what I did to test what you told me:
I added those 2 products to a cart, and asked a friend to see if the product was still available for him and altough I had those 2 products in my cart, he could add those to his cart.. so that kind of confused me from your answer.
I hope I was clear, and sorry for the misunderstanding.