NAV

Use filters in storefront

When enabled, product filters can be used by your customers in the storefront on search and categories pages. Look for “Refine by” block on those pages.

See how to enable filters and manage them in our Help Center.

Filters in query parameters

Filters in query parameters on search page example

GET https://mdemo.ecwid.com/search?keyword=surfboard&inventory=instock

If you’d like to create your own custom filter widget and use Ecwid storefront widget, you can use query parameters in the storefront to filter products on a page.

Filters in query parameters are available for search and category pages.

Query parameters for filters

FieldTypeDescription
keywordstringSearch by a specific phrase
priceFromnumberMinimum product price
priceTonumberMaximum product price
categoriesstringSearch within these categories. Supports IDs separated by comma and value "home" that refers to the Store Home Page
includeProductsFromSubcategoriesbooleanDefines whether Ecwd should search in subcategories too. Only makes sense when categories parameter is set
createdFromstringProduct create date/time (lower bound). Supported formats:
  • UNIX timestamp
Example:
  • 1447804800
createdTostringProduct last create date/time (upper bound). Supported formats:
  • UNIX timestamp
updatedFromstringProduct last update date/time (lower bound). Supported formats:
  • UNIX timestamp
updatedTostringProduct last update date/time (upper bound). Supported formats:
  • UNIX timestamp
option_{optionName}stringFilter by product option values. Format: option_{optionName}=param[,param], where optionName is the attribute name and param is the attribute value. You can place several values separated by comma. In that case, values will be connected through logical “OR”, and if the product has at least one of them it will get to the search results. Example:
option_Size=S,M,L&option_Color=Red,Black
attribute_{attributeName}stringFilter by product attribute values. Format: attribute_{attributeName}=param[,param], where attributeName is the attribute name and param is the attribute value. You can place several values separated by comma. In that case, values will be connected through logical “OR”, and if the product has at least one of them it will get to the search results. Example:
attribute_Brand=Apple&attribute_Capacity=32GB,64GB
inventorystringSearch instock or out of stock products. Possible values: "instock","outofstock"
onsalestringSearch on sale products. Possible values: "onsale", "notonsale"

Filters in custom product listing

Some developers create a whole entirely new and custom product listing for their stores.

Since the listing is retrieved from the API, you will need a way to get available filters and products to display.

1. Get available filters

Check the Filters in REST API section on getting filters for your particular store.

2. Get products according to filters

When you received all the needed filters from the Ecwid API, use those filters when searching for products.

As a result, you will have the list of products that follow your filters and you’ll just need to display them in your custom product listing.