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.

Querying collections for store not returning all collections

Querying collections for store not returning all collections

michaelahouk
Shopify Partner
1 0 0

When querying collections using the endpoint:

https:/{storename}.myshopify.com/admin/api/2023-01/graphql.json

and the request body:

 

 

 

 

{
  collections(first: 50 sortKey: UPDATED_AT reverse:true) {
    edges {
      cursor
      node {
        title
        legacyResourceId
        productsCount
        productsCount
        updatedAt
      }
    }
    pageInfo {
      hasNextPage
      hasPreviousPage
    }
  }
}

 

 

 

 

the response is a single collection Home Page, containing only one product. Our client insists that they have other collections set up. Using this query with a different url and access code works for our other clients' Shopify shops. Is there any way that their collections could be set up incorrectly so that we are not pulling them? 

Reply 1 (1)

Liam
Community Manager
3108 344 889

Hi Michaelahouk,

 

This query you've shared appears to be correctly structured for retrieving collections from the store. Can you confirm that the collections you are expecting to see are properly set up in the Shopify admin?

 

I'd check to see that the collections are not hidden or unpublished, and have products associated with them that have the correct settings to be visible and accessible. I'd also verify that the collections have been assigned the correct visibility settings to ensure they are visible on the storefront.

 

Hope this helps!

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog