New Shopify Certification now available: Liquid Storefronts for Theme Developers

Storefront Variant Metafield Filtering seems to have stopped working

Matth9152
Shopify Partner
5 1 0

Hi,

I have a site set up that was reliant on filtering products using the variant Metafields as such:

 

collection(handle: "${categoryHandle}") {
            handle            
            products(first: 24,            
                filters: {                
                    variantMetafield: {                    
                        namespace: "custom",                        
                        key: "skin_tone",                        
                        value: "yellow"                        
                    }                    
                }                
            )

 

This was working fine on several versions of the Storefront API including 2022-07, 2023-01, 2023-04, and the unstable release at the time, returning the expected array of product nodes, but one by one the feature seemed to be slowly killed off (even on then-live API versions), and now the reply is simply an empty edges array as such:

 

{
    "data": {
        "collection": {
            "handle": "all-heads-new-1",
            "products": {
                "edges": []
            }
        }
    }
}

 

Has something changed in how we should be calling products via this filtering method, or has the functionality been broken?

 

Thank you,
Matt.

Replies 3 (3)
SBD_
Shopify Staff
Shopify Staff
1671 235 346

Hey @Matth9152 

 

Can you let me know which store you're running this query against? And can you confirm no apps (like Search and Discover) have recently been adjusted?

Scott | Developer Advocate @ Shopify 

Matth9152
Shopify Partner
5 1 0

Hi @SBD_ , the store is https://minifigs.me/.

 

As far as I'm aware nothing in Search and Discover has been adjusted. I have checked that the filters still exist both there and in the variant metafields. They do actually still work if they're running via Liquid (e.g. https://minifigs.me/collections/all-heads-new-1?filter.v.m.custom.skin_tone=Light) rather than using the Storefront API.

 

Thanks,

Matt.

SBD_
Shopify Staff
Shopify Staff
1671 235 346

Are you still seeing the same response? I just tested your query with success. Will DM details.

Scott | Developer Advocate @ Shopify