Focusing on managing products, variants, and collections through the API.
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?
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