Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Good morning,
I would like to use hydrogen to create custom filters. I would like to use logical operators such as "<, >, =".
I have metafields to manage dimensions.
For example, I have a "largeur" metafield of type "String".
I managed to add a filter to my local hydrogen site.
If I filter on the "largeur" at "40", I see the products with a "largeur" of "40".
The filter adds the property in my url
http://localhost:3000/collections/brides?largeur=40
React
//I retrieve the property and create a productMetafield to add it to my ProductFilter object if(largeur){ productMetafield = {key: 'largeur', namespace: 'custom', value: largeur} } const {collection} = await storefront.query(COLLECTION_QUERY, { variables: {handle, ...paginationVariables, productFilter: { price, productMetafield }, }, });
Graphql
queryCollection( $handle: String! ... $productPriceFilter: [ProductFilter!] ) @inContext(country: $country, language: $language) { collection(handle: $handle) { ... products( ... filters: $productPriceFilter ) { nodes { ...ProductItem }
I would like to retrieve products from 0 to 40 in "largeur". Could you help me ?
THANKS
Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025