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
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024