Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Storefront API storeAvailability query missing locations

Storefront API storeAvailability query missing locations

MarionOtt
Shopify Partner
3 0 3

Hi,

I would like to get the availability of all my product variants by location, to know whether or not they are available for sale and where.
For this I am calling the storefront API to get my product, and including the storeAvailability field, with the parameter first: X to retrieve all of them.

The query works well, I do get a response, however I only get one location data, even though I have more.
In the admin dashboard, they are all setup the same way with an address and with the option Fulfill online orders from this location enabled.

Here's the query I am using:

 

query {
    node(id: $id) {
        ... on ProductVariant {
            availableForSale
            title
            product {
                title
            }
            storeAvailability(first: 100) {
                edges {
                    node {
                        available
                        location {
                            id
                            name
                        }
                    }
                }
            }
        }
    }
}

 

 
And here's the response I get:

 

{
    "data": {
        "node": {
            "availableForSale": true,
            "title": "34",
            "product": {
                "title": "Title"
            },
            "storeAvailability": {
                "edges": [
                    {
                        "node": {
                            "available": true,
                            "location": {
                                "id": ID,
                                "name": "BOUTIQUE LYON"
                            }
                        }
                    }
                ]
            }
        }
    }
}

 

 

I only get one location result, event though on this specific variant, I added 7 of them with or without inventory.

Thanks for the help!

Replies 2 (2)

Luke_K
Shopify Staff
402 66 102

Hey @MarionOtt 

 

Could I ask if your other locations(that are not returned) have Local Pickup enabled?  Trying this myself for an in stock Product Variant, If I switch my locations to have Local Pickup enabled, then I can make the same query and I'll be returned my locations that have Local Pickup enabled.  storeAvailability on the Product Variant provides the in-store pick up availability of the Product Variant(docs).

 

Alternatively if still no progress after that, please feel free to send me a x-request-id returned from the headers and I'll look into it - let me know how that goes -  thanks!

 

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
MarionOtt
Shopify Partner
3 0 3

Hey @Luke_K , thanks for your reply!


It appears Shopify kept cache from a query I made when the option was indeed enabled. So after I disabled it, I still received an old payload, that's why I thought there was something missing.

All good now, thanks!