# Filter product lists One common requirement for product listings is to include a filtering function, which enables users to narrow down the list based on pre-defined criteria. Norce satisfies this requirement through the use of Filters, and achieves th is by using the [ListProductFilters2](/api-reference/services/productservice/openapi/products/listproducts2) method. This method mirrors the `ListProducts2` method by utilizing the same input parameters, but returns filters based on the same result set that `ListProducts2` would return. ![Product filtering](/assets/product-2.af83e6d5043cae8c72430f1e8e03b901debc8bb8b44cbf591103f67b8c957661.afe294b5.png) It's common to use `ListProducts2` and `ListProductsFilter2` simultaneously. While `ListProducts2` returns a batch of products, `ListProductFilters2` returns filtering information based on the **full result**. You can use this information to build a filtering mechanism in your app. Norce Commerce provides several methods that are similar to `ListProductFilters2` but with some specific variations. | Name | Description | | --- | --- | | [ListProductFiltersByCustomer](/api-reference/services/productservice/openapi/filters/listproductfiltersbycustomer) | Corresponds to `ListProductsByCustomer`. | | [ListProductFiltersByIds](/api-reference/services/productservice/openapi/filters/listproductfiltersbyids) | Corresponds to `ListProductsByIds` | | [ListProductFiltersByPricelist](/api-reference/services/productservice/openapi/filters/listproductfiltersbypricelist) | Corresponds to `ListProductsByPriceList` | ### A step-through example It might be easier to explain filtering and further filtering by walking through an example: table thead tr th Action th Implementation th Result tbody tr td Clicks on a navigation listing (all IPhones) td Calls code ListProducts2 (with category smartphones and manufacturer apple) td The first 10 apple phones are returned tr td Calls code ListProductFilters2 td A list of filters is returned including img and img br Only filters that has a count more than 0 is returned. tr td User chooses to further filter on “iPhone 11” td Calls code ListProducts2 with same input parameters, except the variable “filter” that gets b parf|L6360_13239 (where parameterid for model is 6360 and listid for iPhone11 is 13239) td A new list of ProductItems is returned. Only Iphone 11 this time. (First 10 of 20) tr td Calls code ListProductFilters2 with same input as code ListProduct2 above. td Same list of filters is returned as before but with new count values. br We change all count values in our UI, except for the filter we last changed (Iphone model), to make it easier to change img tr td User chooses to further filter on “iPhone 11 Pro” td Calls code ListProducts2 with same input parameters, and the variable “filter” has now parf|L6360_13239* b L6360_13240 (where listid for iPhone11 pro is 13240) td A new list of ProductItems is returned. Only Iphone 11 and 11 pro. (First 10 of 34) tr td Calls code ListProductFilters2 with same input as code ListProduct2 above. td Same list of filters is returned as before but with new count values. As before, we change all count values in our UI, except for the filter we last changed. img and img tr td User chooses to further filter on “Internal Memory capacity” td Calls code ListProducts2 with filter parf|L6360_13239*L6360_13240* b L6361_13241 (where parameterid for memory is 6361 and listid for 128GB is 13241) td A new list of ProductItems is returned, containing only items with model "Iphone 11" or "11 pro" and internal memory at "128GB". (all product, 7 of 7 returned) tr td Calls code ListProductFilters2 with same input as code ListProduct2 above. td Same list of filters is returned as before but with new count values. As before, we change all count values in our UI, except for the filter we last changed (which this time is the internal memory capacity). img and img tr td User chooses a product page. td code GetProductById is called. td See separate article about [product presentation](working-with-products-and-variants.md#product-presentation). ## The filter and filteritem When using `ListProductFilter`, you will receive a collection of filters that include a `Name`, `Type`, and a list of `FilterItems`. The `FilterItem` may contain different fields depending on the filter type and the parameter type. See more about the [filter schemas](/api-reference/schemas/product#filters). The `Name` value is necessary if you need to add additional filtering to your subsequent calls to the Norce Commerce Product Service (for both `ListProduct` and `ListProductFilter`). The `Type` value provides a more descriptive name. Note If all products in the result set belong to a specific filter, that filter will not be included in the response since it can no longer be used to narrow down the results. For instance, if you list products belonging to a specific category, all products will have that category and no category filter will be included in the response. All calls return the following: - A `Filter` entity containing a `Name` attribute that is used for further filtering. The name ends with an "f" to indicate it is a filter. - On the `FilterItem` level, each item has an `Id` that is used for further filtering, a `Count` that indicates how many products have this filter, and a `SortOrder` (if not null) that specifies how to sort the filters. If it exists, `Uom` is the unit of measurement set on the parameter and can be used in conjunction with the `Name`. ### How to further filter To filter the product result based on user actions, you can create a filter string and pass it as an input parameter to both `ListProduct` and `ListProductFilter`. While `ListProduct` will return a new result set, `ListProductFilter` will return the same filters as before, but with updated count values. The table below provides information on what the `ListProductFilter` returns and how to use it for further filtering. Note Further filtering with many different types of filters implies a logical "and" operation between them. However, when dealing with multiple values of the same type, a logical "or" operation is applied except in the case of parametric filters. Please refer to the restrictions outlined in the table below. | Type (name) | Description | Restrictions | Further filtering | | --- | --- | --- | --- | | Category (*`catf`*) | Returns [FilterItem](/api-reference/schemas/product#filteritem).Id has the categoryId.Products can have one or more categories. | Products can have 0, 1 or many.Filtering on more than one implies a logical “or” between them. | **catf|categoryId1,categoryId2;**example: `catf | | Flag (`flgf`) | Returns [FilterItem](/api-reference/schemas/product#filteritem).`Id` has the `flagId`. | Products can have 0, 1 or many.Filtering on more than one implies a logical “or” between them. | **flgf|flagId1,flagId2;**`flgf | | Manufacturer (`mfrf`) | Returns [FilterItem](/api-reference/schemas/product#filteritem).`Id` has the `manufacturerId`. | Products must have 1.Filtering on more than one implies a logical “or” between them. | **mfrf|manufacturerId1,manufacturerId2;**`mfrf | | OnHand (`ohf`) | Returns [FilterItem](/api-reference/schemas/product#filteritem).`Count` has the number of products that has on-hand over 0. | Products can have true or false.Multiple values are not allowed. | **ohf|[true or false];**`ohf | | Price (`prcf`) | Returns [FilterPriceItem](/api-reference/schemas/product#filterpriceitem).The fields `From`, `To`, `FromIncVat`, `ToIncVat` is returned. | Products can have any decimal value.Multiple ranges are not allowed. | **prcf|[inc/excl vat]_[from]-[to];** `prcf | | Parametric (`parf`) | Returns a list of [FilterItem](/api-reference/schemas/product#filteritem)'s. | Products can have 0, 1 or many.! or * separates the different parametric filters.Filtering on many different parametrics implies a logical “and” between them.Many filters between same parametric implies a logical “or”. | **parf|[list and multiplelist filters]*[range and bool filters];****parf|ListFilter*MultiFilter*RangeFilter*BoolFilter;** | | Parametrics of type List | If returned, it is a [FilterListItem](/api-reference/schemas/product#filterlistitem)Contains a list of [FilterItem](/api-reference/schemas/product#filteritem)'s representing the different parametric list values. | - | **L[ParameterId]_[ListValueId]*** `L6360_13239*` | | Parametrics of type MultipleList | If returned, it is a [FilterMultiItem](/api-reference/schemas/product#filtermultiitem) | - | **M[ParameterId]_[MultiListId]*** `M6355_3390*` | | Parametrics of type Integer, Decimal or Date. | If returned, it is a [FilterRangeItem](/api-reference/schemas/product#filterrangeitem) | - | **V[ParameterId]_[From]-[To]**`V60_256-1024``V123_1.4-2.5` | | Parametrics of type Boolean | If returned, it is a [FilterBoolItem](/api-reference/schemas/product#filterboolitem)`Count` (number of Products that have the value true), `FalseCount` (number of Products that have the value false). | - | **V[ParameterId]_[0 or 1]-[0 or 1]** `V123_1-1` (123 is set to true)`V123_0-0` (123 is set to false)`V123_0-1` (123 is set to true or false) | Note Please note that all filter parameters are returned, however, the Text and Html parameters, despite being set as filters, will not be included.