How can I update the 'In stock' product attribute using API?

Solved

How can I update the 'In stock' product attribute using API?

OnePrg
Tourist
11 0 7

Please give an example or a link to documentation on how to update the “In stock” product attribute.

Accepted Solution (1)
Kalen_Jordan
Shopify Partner
669 26 109

This is an accepted solution.

I think the reason available is null is because you don't have Track quantity ticked.

View solution in original post

Replies 7 (7)

Kalen_Jordan
Shopify Partner
669 26 109

One way to approach this is by setting the inventory levels using the API call:

https://shopify.dev/docs/api/admin-rest/2023-10/resources/inventorylevel

OnePrg
Tourist
11 0 7

Does not work. For example, I want to receive remaining goods.

I do admin/api/2023-07/products/7201269383337.json and get 

"inventory_item_id"44019896254633
 
Then I do /admin/api/2023-10/inventory_levels.json?inventory_item_ids=44019896254633&location_ids=65058963625 and get follow 


{
    "inventory_levels": [
        {
            "inventory_item_id"44019896254633,
            "location_id"65058963625,
            "available"null,
            "updated_at""2022-07-28T19:24:01+03:00",
            "admin_graphql_api_id""gid://shopify/InventoryLevel/99386556585?inventory_item_id=44019896254633"
        }
    ]
}


"available": null

but the website shows "in stock"

Screenshot - 10.11.2023 , 9_07_00.png
Kalen_Jordan
Shopify Partner
669 26 109

Hmm and you're sure that you have inventory tracking enabled on that one? Also do you have Continue Selling When Out Of Stock enabled?

OnePrg
Tourist
11 0 7

I will find out this from the site admin.

 

Can this be done through a third party plugin?

Kalen_Jordan
Shopify Partner
669 26 109

You can find that in the shopify admin:

61a2666142989262440e376d_continue-selling-when-out-of-stock.png

OnePrg
Tourist
11 0 7

0-02-05-39d887f8ecb255d2d5f7e05eb56f4a31e201522c36f1b3e7887cb47e7d6d2133_4190289a.jpg

Kalen_Jordan
Shopify Partner
669 26 109

This is an accepted solution.

I think the reason available is null is because you don't have Track quantity ticked.