Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
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.
Solved! Go to the solution
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.
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.
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
Thanks a lot. Your hint helped me indeed.
My case was that there are only 2 products returned though there are about 100 of items with a few variations each. They were recently imported by a client and no sales channels were selected at all.