Solved

GraphQL locations query

NatDev
Shopify Partner
7 1 1

Hey,

I'm trying to run this query on GraphiQL 

locations(first:100){
   nodes{
   name
  }
}

 

but it always returns an empty array, although I can see my locations on admin panel also, I have full permission and all other queries work fine.

Accepted Solution (1)

NatDev
Shopify Partner
7 1 1

This is an accepted solution.

I found the problem.

 

locations query returns only the locations which support picking up feature.

make sure you check this option in `shipping and delivering` settings for each location you want.

View solution in original post

Replies 9 (9)

oscprofessional
Shopify Partner
15897 2378 3084

Hi @NatDev ,

Please change your query to,

{	
  locations(first:100){
    edges{
      node{
        name        
      }
    }
  }
}

Thanks .... 

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
NatDev
Shopify Partner
7 1 1

Hey Oscprofessional,
still the same problem 

 

Screenshot 2023-04-11 094103.png

oscprofessional
Shopify Partner
15897 2378 3084

Hi @NatDev ,

Try this, It is working

{
  locations(first: 100) {
    edges {
      node {
        name
      }
    }
  }
  collections(first: 10){
    edges{
      node{
        id
      }
    }
  }
}

 

Thanks....

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
NatDev
Shopify Partner
7 1 1

No, it's not working.

locations query keeps returning an empty array.

 

Screenshot 2023-04-11 123624.png

oscprofessional
Shopify Partner
15897 2378 3084

Hi @NatDev ,

Did you assign store name here,

oscprofessional_0-1681202509274.png

If not please update and try again.

Thanks....

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
NatDev
Shopify Partner
7 1 1

Yes, sure I have store name.

everything is working ok for me all other queries return data correctly except this one.

oscprofessional
Shopify Partner
15897 2378 3084

Hi @NatDev ,

Could you please share store url and credentials so that I can run the query and check the issue.

Get pass your Store Core Web Vital Free Speed Optimization Audit, Chat on WhatsApp | Skype : oscprofessionals-87 | Email: pallavi@oscprofessionals.com | Hire us | Guaranteed Site Speed Optimization | Website Free Audit | Shopify Theme Customization | Build Shopify Private App | Shopify SEO | Digital Marketing | Oscp Upsell & Cross sell App : Free | Oscp Sales & Volume Discount App : Free | Custom Pricing Wholesale App : Free
NatDev
Shopify Partner
7 1 1

Sorry, I can't .

NatDev
Shopify Partner
7 1 1

This is an accepted solution.

I found the problem.

 

locations query returns only the locations which support picking up feature.

make sure you check this option in `shipping and delivering` settings for each location you want.