Complete product filtering solution for WPGraphQL and WooCommerce with attribute ranges and aggregations.
Provides comprehensive filter data for building dynamic product filters in headless WooCommerce stores, including:
- Price range filtering and aggregations
- Numeric attribute range filtering (e.g., size: 10-50)
- Aggregated data with counts for all attributes, brands, and categories
- Full compatibility with existing WooGraphQL filters
- Price Range Data: Get min/max prices from current product set
- Attribute Aggregations: All available attribute values with counts + numeric ranges
- Brand Aggregations: All available brands with product counts
- Category Hierarchy: Full support for parent/child categories
- Numeric Attribute Filtering: Filter products by numeric attribute ranges
- Dynamic Ranges: Automatically detects numeric attributes and provides min/max values
- Performance Optimized: Efficient SQL queries with proper indexing
- Upload plugin to
/wp-content/plugins/woographql-product-filters/
- Activate plugin in WordPress admin
- Ensure WPGraphQL and WPGraphQL for WooCommerce are active
- WordPress 6.0+
- WooCommerce 9.0+
- WPGraphQL
- WPGraphQL for WooCommerce
query ProductsWithFilters {
products {
nodes {
id
name
price
}
aggregations {
priceRange {
min
max
}
attributes {
name
slug
type
range {
min
max
}
terms {
name
slug
count
}
}
brands {
name
slug
count
}
}
}
}
query FilteredProducts {
products(where: {
attributeRange: [
{ attribute: "size", min: 10, max: 50 },
{ attribute: "weight", min: 5, max: 25 }
]
}) {
nodes {
id
name
price
}
}
}
query CombinedFilters {
products(where: {
minPrice: 100
maxPrice: 500
taxonomyFilter: {
filters: [
{ taxonomy: PRODUCT_CAT, terms: ["electronics"] }
]
}
attributeRange: [
{ attribute: "screen_size", min: 15, max: 27 }
]
}) {
nodes {
id
name
price
}
aggregations {
priceRange { min max }
attributes {
name
range { min max }
terms { name count }
}
}
}
}
AttributeRangeFilter
: Filter by numeric attribute ranges
ProductFilterAggregations
: Main aggregations containerProductAttributeAggregation
: Attribute with range + termsProductAttributeRange
: Min/max values for numeric attributesProductPriceRange
: Price min/max valuesProductAttributeTermAggregation
: Attribute term with countProductBrandAggregation
: Brand with count
- Faceted Navigation: Build complete filter interfaces
- Price Sliders: Dynamic price ranges based on actual data
- Attribute Filters: Both text-based and numeric range filters
- Category Filters: With accurate product counts
- Brand Filters: All brands with availability counts
- Optimized SQL queries with proper joins
- Caching for term hierarchies
- Minimal database impact
- Compatible with WooCommerce product visibility settings
MIT License - see LICENSE file for details.