What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Collection page custom filter using metafield not working

Collection page custom filter using metafield not working

sumitsharma7667
Shopify Partner
2 0 0

I'm having trouble getting metafields to work with my products on Shopify. I'm on the Basic plan, and I've tried setting up metafields, but they don't seem to be functioning correctly. Can someone help me troubleshoot this issue or provide guidance on how to properly use metafields with products on a Shopify Basic plan?

 

 

Screenshot 2024-05-30 at 10.46.57 AM.pngScreenshot 2024-05-30 at 10.46.44 AM.pngScreenshot 2024-05-30 at 10.46.39 AM.png
query tumbleDryProducts {
  collection(handle: "states") {
    handle
    products(
      first: 10
      filters: {productMetafield: {namespace: "custom", key: "state",      value: "Kerala"}}
    ) {
      edges {
        node {
          id
          title
          metafield(namespace: "custom", key: "state"){
            key
            namespace
            value
          }
        }
      }
    }
  }
}

 

Replies 2 (2)

Eric-HAN
Shopify Partner
260 29 27

Hi, there 

Unfortunately, there is no way to query products by metafield value or any other "custom" field value in admin API.  But I think you could use tags instead.

 

if you use headless in storefront ,This could be correct .  
So my question is you use  the code in storefront or admin Graphql API?

 

- Helpful? Please hit Like and mark it as a solution
Want to modify or custom changes on store? Let me help.
- Feel free to Email Me    Buy Me A Coffee
sumitsharma7667
Shopify Partner
2 0 0
Thanks for reply.

@Eric-HAN wrote:

Hi, there 

Unfortunately, there is no way to query products by metafield value or any other "custom" field value in admin API.  But I think you could use tags instead.

 

if you use headless in storefront ,This could be correct .  
So my question is you use  the code in storefront or admin Graphql API?

 




Yes, I am using code for the StoreFront GraphQL API. I'm building my storefront with hydrogen and Remix