I’m just getting started with the new Shopify GraphQL Admin API. I’m trying to retreive all products, where the title
field contains a certain word.
Currently I can successfully retrieve a product by including the full product title (exact match):
{
shop {
id
name
}
products(first: 10, query:"title:'RAVEN DUSTY OLIVE/SILVER MESH'") {
edges {
node {
productType
title
}
}
}
}
However, I want to partially match the title to display all products with the word “Raven” anywhere in the title, but the following returns no results:
{
shop {
id
name
}
products(first: 10, query:"title:'RAVEN'") {
edges {
node {
productType
title
}
}
}
}
Any ideas on how to get the partial matching working?
2
Answers
Bjorn! This should work:
Check out the docs: https://help.shopify.com/en/api/getting-started/search-syntax
Also you can try with
query: "title:*${searchText}*"
you can see two * at the initial and the end