Collection query by $id returns null on collections published to all sales channels

nicotroplent
Shopify Partner
21 0 0

Hello everyone,

 

I am currently facing an issue with accessing my store's collections through the Storefront API. Despite ensuring that my collections are published on all sales channels and granting Product and Collection API permission to my headless storefront, my GraphQL query returns null. I have been trying to troubleshoot this problem without success. Also, I am on a development store.

 

I would greatly appreciate any assistance or guidance that the community can provide in resolving this issue.

 

Here are the queries I have been using:

By id 

query getSingleCollection($id: ID!){
  collection(id: $id){
    products(first: 2){
      edges {
        node {
          id
        }
      }
    }
  }
}

By handle

query getSingleCollection($handle: String!){
  collectionByHandle(handle: $handle){
    products(first: 2){
      edges {
        node {
          id
        }
      }
    }
  }
}

Response - 

{
  "data": {
    "collection": null
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 5,
      "actualQueryCost": 1,
      "throttleStatus": {
        "maximumAvailable": 1000,
        "currentlyAvailable": 956,
        "restoreRate": 50
      }
    }
  }
}

Thank you in advance for your help!

Nico

Did I solve your issue? Like & Accept Solution to help the community
Want to customize your store, contact me nicotroplent@gmail.com
Nico - Shopify Partner
Reply 1 (1)

fahjan
Visitor
1 0 0

did you find the solution ?