GraphQL query some products return null.

Solved
eaboy
New Member
2 0 1

Hi I'm Eduardo.

I'm currently working with the GraphQL Storefront API and I'm facing an issue and need some help with it. Basically I'm doing a request of products based on the product ids and for most of the products works fine but there are some that are returning a null node. I've tried the exact same request in the Shopify GraphiQL App and there I'm getting the correct data, no null nodes. Also checked and the product ids are correct. What could be happening here?

This is the query:

 

 

query SpecificProduct($ids: [ID!]!) {
  nodes(ids: $ids) {
    ... on Product {
      id
      title
      handle
      tags
      images(first: 1) {
        edges {
          node {
            src
          }
        }
      }
      variants(first: 100) {
        edges {
          node {
            price
            id
            sku
            title
            compareAtPrice
          }
        }
      }
    }
  }
}

 

 

And as variables, I pass an array of encoded gids.

In the response, some of the nodes have correct product data but some are null.

Any help will be appreciated. 

 

Accepted Solution (1)

Accepted Solutions
c10s
Shopify Partner
65 12 13

This is an accepted solution.

Might be that the products returning null aren't available on the relevant sales channel (your Storefront API channel). Can double check it on the edit product page in the Shopify admin.

View solution in original post

Replies 3 (3)
c10s
Shopify Partner
65 12 13

This is an accepted solution.

Might be that the products returning null aren't available on the relevant sales channel (your Storefront API channel). Can double check it on the edit product page in the Shopify admin.

eaboy
New Member
2 0 1

Thanks @c10s  it was just that. Those products were not added to the channel. 

den232
Shopify Partner
96 1 25

Just for the record, the products also have to be active.  I imported a bunch and they didn't show ... that was the problem for me.  Cheers jb