Hi guys. Currently we have customers reporting issues with querying products with unlisted products using Storefront API
Documentation says such products shouldn’t be available in products(query: "")and must be queries directly by id or handle but in fact Storefront API returns null instead of a product. I can reproduce the issue on lastest API version
query getProductsByIds {
p0: product(id: "gid://shopify/Product/7478331834425") {
requiresSellingPlan
sellingPlanGroups(first: 100) {
edges {
node {
name
sellingPlans(first: 100) {
edges {
node {
id
}
}
}
}
}
}
}
}
Or maybe by using nodes query
query getProductsByIds {
nodes(
ids: [
"gid://shopify/Product/7478331834425",
"gid://shopify/Product/7478332031033"
]
) {
... on Product {
requiresSellingPlan
sellingPlanGroups(first: 100) {
edges {
node {
name
sellingPlans(first: 100) {
edges {
node {
id
}
}
}
}
}
}
}
}
}
But in both cases Storefront API returns null instead of unlisted product
Response example for nodes query: first product has unlisted status while second one has active status
{
"data": {
"nodes": [
null,
{
"requiresSellingPlan": false,
"sellingPlanGroups": {
"edges": [
{
"node": {
"name": "Subscribe & save",
"sellingPlans": {
"edges": [
{
"node": {
"id": "gid://shopify/SellingPlan/6492061753"
}
}
]
}
}
}
]
}
}
]
},
"extensions": {
"cost": {
"requestedQueryCost": 191
}
}
}
What’s interesting that Shopify GraphiQL App returns data correctly – I suspect it works due to using private access tokens while we use public ones to query data from live page