Discuss all the new features introduced with the new product model in GraphQL.
I'm building a variant picker. Users can input a keyword to search through all variants of a product. Previously, I could search for the product with a similar query (e.g. products(first: 50, query: "*black*").
My query:
When I run the query, Shopify gives me the error like this:
result = {'errors': [{'message': "Field 'variants' doesn't accept argument 'query'", 'locations': [{'line': 9, 'column': 38}], 'path': ['query', 'product', 'variants', 'query'], 'extensions': {'code': 'argumentNotAccepted', 'name': 'variants', 'typeName': 'Field', 'argumentName': 'query'}}]}
If variants cannot accept this query, how can I support users to find the variants in a product?
Hi @jam_chan ,
Thanks for asking this question.
>Previously, I could search for the product with a similar query (e.g. products(first: 50, query: "*black*").
To be sure, what is the reason you can't do this now?
> When I run the query, Shopify gives me the error like this:
This is true, even from 2023-07 we did not support this capability
https://shopify.dev/docs/api/admin-graphql/2023-07/objects/Product#connection-variants
> If variants cannot accept this query, how can I support users to find the variants in a product?
We agree that this is an issue with 2K variants, we will look into this and come back with a solution
Yes, I can search for the product with a keyword. This is working well now. I assumed it worked for variants as well. Thanks for getting back to me. Hope Shopify can come up with something.
In other words, the current way only supports users to scroll through the 2,000 variants in order to select some of them?