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

Highlighted
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 4

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
Highlighted
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
Highlighted
Tourist
15 0 0

was you able to sort it out?
i need this same information for my app

0 Likes
Highlighted
Tourist
9 0 2

Hi @emilbryggare ,

Was looking to get a list of countries from Shopify's API and your solution worked perfectly for me! Thanks!

Also, may I know which part of Shopify's documentation provides examples on how such an GraphQL query is made? I was looking though the Admin API GraphQL Reference but did not come across anything similar to the solution you provided.

I was hoping you could point me in the right direction so I can look into it myself in more details so I would know better what other information is available.

I am currently building a Headless Shopify App. So knowledge and information like your solution will be very useful for me.

Regards,
Eugene Oei

0 Likes
Highlighted
New Member
1 0 0

First of all, where are the docs for how you came up with this query.

 

Second, where is the provinces for each on of those countries? Without the provinces, this is 100% useless.

 

Has anyone been able to get a solution from Shopify?

0 Likes