π§° Product Filters
getCollection() supports powerful filtering options to let you narrow down your product list dynamically.
Each filter is written as an object and passed inside the filters array.
filters: [
{ available: true },
{ productType: "Solar Kits" },
{ productTag: "Featured" },
{
price: {
min: 100,
max: 2000,
},
},
{
productMetafield: {
namespace: "custom",
key: "category",
value: "Panneaux Solaires",
},
},
{
variantOption: {
name: "Color",
value: "Black",
},
},
];
π§© Supported Filter Typesβ
β
availableβ
{
available: true;
}
Returns only published + available products.
π·οΈ productTypeβ
{
productType: "Solar Kits";
}
Filter by Shopify product type.
π productTagβ
{
productTag: "Featured";
}
Match products that have a specific tag.
π§ͺ productMetafieldβ
{
productMetafield: {
namespace: "custom",
key: "category",
value: "Batteries",
},
}
Filter products by metafield value (must be a defined metafield in Shopify admin).
You must have this metafield defined under:
Settings β Custom data β Products β [Your Definition]
And enable:
- β Filtering for products
- β Storefront API access
Otherwise, filtering wonβt work.
ποΈ variantOptionβ
{
variantOption: {
name: "Size",
value: "Medium",
},
}
Filter products where a variant has a specific option name/value.
πΆ priceβ
{
price: {
min: 100,
max: 500,
},
}
Filter products by variant price range (Shopify uses the first variant's price for comparison).
π¦ collectionβ
{
collection: "solar-kits";
}
(Only works if collection filtering is supported in your setup)
β Next: Pagination β
Description
Filter Shopify products by availability, type, tags, price, and even metafields.