Shopify Liquid store_availability is empty

Highlighted
New Member
4 0 0

Hi,

i have 2 locations where ive enabled pickup.

My Test product has 1 variant with an inventory of 5 at location 'A' and 2 at location 'B'.

In Liquid i now have implemented following code to my product-template:

{% if product.selected_or_first_available_variant.requires_shipping %}
  {% for variantPickupLocation in product.selected_or_first_available_variant.store_availabilities %}
    {{ variantPickupLocation.available }}
  {% endfor %}
{% endif %}

 

I would expect to see true/false on my product page, but the store_availabilties object is empty.

With the URL https://mystore.myshopify.com/variants/36996986241178/?section_id=store-availability i can see however, that my store/product settings are correct and it returns store availabilities.

What am i doing wrong?

0 Likes
Highlighted
New Member
4 0 0

Ok, its a bit crazy.

First time loading the product page it loads the data. But after refreshing the page with F5 the same liquid code returns nothing.

Also variant.store_availabilities should return a list of StoreAvailability Objects back instead it returns just the first StoreAvailability Object back, although my test product is available at 2 stores.

How is this possible, there has to be an error in the backend.

 

Could you guys please check this problem?

0 Likes
Highlighted
New Member
1 0 0

First time loading the product page it loads the data. But after refreshing the page with F5 the same liquid code returns nothing.

When I put this {{product.selected_or_first_available_variant.store_availabilities.first.location.address.city}} and try open page, then with "/product-handler?variant=some_variant_id" I see "city", but when I open without ?variant "/product-handler" I see nothing. I try different ways, but store_availabilities empty without ?variant in url.

0 Likes