Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Hey,
I would like to display my products' inventory location on my website's product page. The product's inventory location can be found under the according product:
I have tried editing the code in the product.liquid file, like this:
<!-- some code -->
{% assign availabilities_array = product.selected_or_first_available_variant.store_availabilities %}
{% for availability in availabilities_array %}
{% assign location = availability.location %}
<p>{{location.name}}</p>
{% endfor %}
<!-- more code -->
Unfortunately, the availabilities_array is always empty.
I am looking forward for your help and thank you in advance.
Best regards
Is it a case that you need to enable local pickup? Your code seems to work when it's enabled. There's something here about the store_availability object: https://shopify.dev/api/liquid/objects/storeavailability
"The store_availability object is defined only if one or more locations has local pickup enabled."
I'm having a similar problem. The "store_availabilities" liquid object is always empty. I have tried enabling/re-enabling Local Pickup on the one location that we have but the backend still returns nothing when trying to access it via liquid. Strangely enough, I am able to access the same information via the Storefront API.
I also tried the exact same theme code on another development store with Local Pickup enabled and everything works fine. I'm convinced there is a backend issue here but Shopify support keeps directing me to contact a Shopify Expert to have a look at the theme code.
Have you made any progress with this?
Hello @Josh18 ,
I am very sure that there is a problem with Shopify's backend.
Like you, I have enabled the "local pickup" option. I have checked if my location has the needed product variant in stock. I have read the Shopify Devs. But nothing seems to work.
The variant.store_availabilities array is always empty.
I have stopped working on this problem.
Best regards
Alocard
Hi there,
Perhaps our app may help solve this for you, so I wanted to share.
https://apps.shopify.com/metastock
Our app allows you to display inventory by location. It also allows customers to select a store that smooths out the whole shopping experience, don't the website. It is very similar to how Target and other big box retailers handle this issue, so it's a great app for brick-and-mortar stores on Shopify. Because it provides the best user experience for customers using your website.
If you have any issues with the implementation just drop us a line. We're always willing to help our customers as best we can. 😀
Also, here is a video that describes the app and provides an overview. You may find this helpful in deciding if the app is right for you and best solves the issue.
Hope this helps and wishing you all the best!
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024