Display variant inventory quantity with locations on product page (Minimal theme)

ledprofiles
New Member
3 0 0

Hi,

I applied the suggested code on below link to display the variant inventory quantity on my product page. And that worked great!

Now I want to adjust the code to take it to the next level. I want to add the inventory quantity by location (We have multiple locations). To show like availability on location A is X and location B is Y.

Any chance someone worked on it before?

https://community.shopify.com/c/Shopify-Design/Display-variant-inventory-quantity-on-product-page-Mi...

0 Likes
pvoulg
Shopify Partner
171 26 45

Hi @ledprofiles,

Unfortunately, this is not possible just by adding code to your product template. Liquid doesn't have access to location inventory levels (just the total), so unless that changes, there' no way to do that yet. You can look into apps that offer this functionality.

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
0 Likes
ledprofiles
New Member
3 0 0

thanks for your quick reply. Unfortunately I even could not find a free or paid app that shows the variant quantities per location. Any suggestion?

0 Likes
pvoulg
Shopify Partner
171 26 45

I found the following at the app store:

Can't vouch for any of those, because we've never used any, but they seem to have 14-day trials, so you can check them out.

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
0 Likes
Sebastian_Young
Explorer
57 1 29

In the documentation for variant.store_availabilities, it says "Returns an array of store_availability objects if variant.selected is true." For variant.selected to be true, the variant must be specified as a URL parameter. However, I'm still not able to get it to return anything, even with this in place.

0 Likes
pvoulg
Shopify Partner
171 26 45

Hi @Sebastian_Young,

The variant.store_availabilities only shows if a variant is stocked in a specific location (mostly used to determine if a product can be picked up from a location), it doesn't come with stock levels. There's an implementation example here: https://shopify.dev/tutorials/add-store-availability

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
0 Likes
Sebastian_Young
Explorer
57 1 29

Thanks @pvoulg. I don't need actual levels per location, just whether it is available at a location, but I still can't get it to return anything. I've seen that example implementation, which is not exactly what I'm trying to achieve. Essentially I just need to know, for each variant, if it is available at one of our two locations. Any idea on how to do this?

0 Likes
pvoulg
Shopify Partner
171 26 45

So, yeah, as far as I can tell, this seems to be a Liquid bug or error. Some have noted that pickup needs to be enabled for all locations for it to work, whereas others have said that this doesn't work even when they are enabled. I will investigate further and get back to you if I figure anything out.

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
0 Likes
Sebastian_Young
Explorer
57 1 29

Thanks @pvoulg. We don't have pickup enabled because that requires multi-origin shipping to be enabled. I haven't enabled this, and don't think I want to, given that it's irreversible!

0 Likes