Get all countries from countries.json (not 'Rest of World')

Tourist
4 1 1

Hi all!

Can you help me?

 

`admin/countries.json` gets only 2 countries: "US" and "Rest of World".

But i need list of "Rest of World" countries. On default checkout page there are request, like:

 

https://cdn.shopify.com/app/services/2497675309/javascripts/checkout_countries/34562146349/en/countr...

 

And it returns all countries, not only 2. So, how i can get this list via API?

0 Likes
Highlighted
Shopify Partner
21 0 3

Hi @AndrewSi,

 

You can request a list of all countries using the GraphQL API:

query {
    # previous queries
    __type(name: "CountryCode") {
       states: enumValues {
           name
           description
       }
    }
}

Or you could just create a local list that your code can access based on https://help.shopify.com/en/api/graphql-admin-api/reference/enum/countrycode.

 

Hope it helps. :)

Founder of Evermark - Smart and automated Facebook ads for your Shopify store.
0 Likes
Shopify Partner
9 1 0

Thx @emilbryggare , but this does not help me.

I need all info about countries AND it's provinces (if they are). At least 'code'.

 

So UP

0 Likes