Inventory levels will no longer be available through the public product.json

Shayne
Shopify Staff
Shopify Staff
216 11 49

In 30 days, inventory levels will no longer be returned by the public product.json that's available on the storefront of newly created shops. If you want to consume inventory information about a product, you'll have to auth with the store first. This is a part of our effort to eliminate bots and crawlers from knowing inventory levels of products from stores that they haven't explicitly been granted access to.

The inventory quantity will still be available through liquid, and won't affect any themes on our theme store.

Feel free to post questions here, and I'll be happy to answer.

Shayne | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

Replies 11 (11)
Matt_Stubbs
Shopify Partner
70 0 11

Hi Shayne,

I understand the desire to prevent crawlers gathering data. However, I have two concerns about this announcement:

1. We use the ScriptTag API to load a widget on the product page which then fetches inventory levels using the product.json API. This avoids having to edit theme templates. It sounds like this is no longer supported and we will now need to have store owners paste Liquid code into templates themselves?

2. The 30 day window is rather short to be able to implement, test, and rollout any possible workaround. Plus, it means the the change will take affect on December 17. This a very busy time of year for rmany stores and doesn't seem like the best time to push out a breaking API change.

I'd be interested to hear your thoughts on the above.

Cheers,
Matt

Developer of Back in Stock, the easiest way to increase sales on out of stock products. https://apps.shopify.com/back-in-stock
Joshie
Shopify Partner
3 0 1

Shayne,

30 days is very tight during this time of year. If we manage multiple assets that use this feature differently, we're in big trouble with holidays coming up:

  1. Holiday timelines are already tight and now we have to do some extra, free work.
  2. This could introduce bugs or other issues into store functionality and bring down shops right before xmas and the new year.

We definitely need more time for this. Please consider extending the timeline.

Best,

joshie

sdn90
Shopify Partner
1 0 0

Would you guys consider adding in an `availability` field?

rickydazla
Shopify Expert
711 0 84

Wouldn't this also affect OptionSelectors?

I'm a million different people
Matt_Stubbs
Shopify Partner
70 0 11

I believe OptionSelectors renders the product data as JSON using the Liqiud product variable so don't think it will be affected.

Sidenote: a lot of stores use OptionSelectors so I'd expect crawlers will just start harvesting that data instead.

Developer of Back in Stock, the easiest way to increase sales on out of stock products. https://apps.shopify.com/back-in-stock
Shayne
Shopify Staff
Shopify Staff
216 11 49

Hey everyone,

Thanks for your feedback. The 30 day deprecation date will be for new shops onlyExisting stores will continue to have the inventory_quantity available through their product.json. Shops created after the deprecation will not have this attribute available.

Shayne | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me 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

Jack_Lee3
Shopify Partner
63 0 1

We call product.json through the API.  Will this be affected?

 

I'm thinking not, because all our shops authorize the app, but want confirmation. Thanks

Marius_from_Sup
Shopify Partner
179 0 34

Shayne,

How can one still be able to tell if a product is available or not, from public .json?
(similar to liquid {{product.available}})

Thanks!

Streamline your shop and sell more http://www.suppleApps.com
Marius_from_Sup
Shopify Partner
179 0 34

Shayne,

How can we tell if a product variant is available or not, from public .json?
(similar to liquid {{product.available}})

Previously, we were checking inventory_quantity, in case inventory_managed == 'shopify'.

This is a critical feature for Upsell apps.

Thanks

Streamline your shop and sell more http://www.suppleApps.com
Brian_McKinley
Shopify Partner
14 0 5

Shayne,

I just spent a good deal of time trying to figure out why my theme was not working on a new store before finding this post.  I am not happy about this change. 

If you remove the inventory levels you should at the very least replace it with an available attribute to be consistant with the liquid product json.  Better yet, you should give the store owner control over this behavior instead of deciding you know what is best for them.  You could always make the default to suppress the inventory information.  My stores makes heavy use of product.json through ajax requests in order to overcome the limitations of Shopify and I do not have a concern about bots collecting inventory levels. 

I am amost afraid to post this incase you decide to "fix" this as well, but it looks like we can work around the lack of the available attribute on the public product.json by creating a collection for each product and using the public:

collections/{{collection-handle}}/products.json

The output includes the available attribute.
 

Mike44
New Member
3 0 0

If I am an older store how do I get the newer JSON?  I don't want inventory levels showing up.

 

thanks