A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I am probably missing something simple but I cannot find what.
When I run this GraphQL query in the Shopify GraphiQL App it comes back with 10 products:
{
shop {
name
}
products(first: 10) {
edges {
node {
id
title
description
}
}
}
}
When I add a query filter like this:
{
shop {
name
}
products(first: 10, query: "title=bike") {
edges {
node {
id
title
description
}
}
}
}
It comes back with nothing 😞 , but when I run this on https://shopify.dev/apps/tools/graphiql-admin-api it works. Is there maybe some setting in the shop that I am missing that doesn't allow filtering on title?
Other queries I tried which where not working:
Hopefully someone can shine a light and push me in the right direction.
Solved! Go to the solution
This is an accepted solution.
Hey @maartenvdh
Thanks for getting in touch! So I'd tried this below in GraphiQL with the equality comparator(docs) on my title, which is the way of returning the product title - please see below.
{
shop {
name
}
products(first: 10, query: "title:mycoolproduct") {
edges {
node {
id
title
description
}
}
}
}
I'm returned two results in my store's GraphiQL app - that's expected for me as I only have two products on my store that hold the title of 'mycoolproduct'. There's some further docs here on comparators here if needed too. Hope that helps!
This is an accepted solution.
Hey @maartenvdh
Thanks for getting in touch! So I'd tried this below in GraphiQL with the equality comparator(docs) on my title, which is the way of returning the product title - please see below.
{
shop {
name
}
products(first: 10, query: "title:mycoolproduct") {
edges {
node {
id
title
description
}
}
}
}
I'm returned two results in my store's GraphiQL app - that's expected for me as I only have two products on my store that hold the title of 'mycoolproduct'. There's some further docs here on comparators here if needed too. Hope that helps!