A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I tried to use the admin API to get all variants with a special value in a metafield. Okay this isn´t possible with the admin API. Then I tried to do this via the Storefront API because there is an example in the docu, but the filter has no effect.
Documentation
Filter products in a collection with the Storefront API (shopify.dev)
There is only one variant with "LC" in the metafield "custom.box", but I got 100 products. The filter is ignored.
query box { collection(handle: "all") { handle products( filters: {productMetafield: {namespace: "custom", key: "box", value: "LC"}} first: 100 ) { edges { node { id title } } } } }
It would be very useful to have this kind of filter also in the admin / API and of course filtering correctly.
Hi, Have you installed "Shopify Search & Discovery"? If you installed, Did you adjust the settings?
No .. but now .. if there is an "textline" "LC" it works now, but because of only a "textline" is possible, I added "LC:Code,MC:Add" .. now I can not filter for "LC" or "LC:" .. or is there an case sensitive way to query for this?
I know there is no way to do this as a query. But always convert to uppercase when adding a metafield. Convert the word to uppercase when filtering. This way it might be possible.
If it is not possible to enter data this way, you can make a shopify app. In this way, you can enter data into products and convert it to uppercase letters in the background.
I don´t understand what you mean .. it´s not possible?! The content of the metafield "LC:Code,MC:Add" is written in this way, because I only can filter simple textline fields and I need to store an list with 0 to 10 comma separated key-value-pairs. At the end I need to filter based on the key "LC".
Normally with the admin API. My approach, if it´s not possible, is to do this mapping in a separate database.