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 GraphQL API get list of available countries and states/provinces

Storefront GraphQL API get list of available countries and states/provinces

shadtek
Shopify Partner
2 0 5

 

How do I get a list of the countries and their states/provinces with the Storefront GraphQL API?

I am creating a page in React where a customer can edit their address. I want to use the Storefront GraphQL API because that is what all of the other queries in my React site are written with.

I tried this query but it looks like the states/provinces are not available to be retrieved. Why are the states/provinces not available here?


https://shopify.dev/api/storefront/2022-01/objects/Country#fields

 

{
  localization {
    availableCountries {
      name
    }
  }
}

 

 

Screen Shot 2022-03-18 at 10.25.56 AM.png

 

Replies 4 (4)

masabmehmood
Visitor
2 0 0

Hi

did you get any solution to fetch the states/Province

 

mason225
Shopify Partner
16 0 5

Did you found the solution? I'm stucking on this also.

Michael_Tot
Visitor
3 0 0
mason225
Shopify Partner
16 0 5

it's not working