How-to filter products

There might be a situation where you want to filter a list of products by title, price etc. This can be done by using the shortcode attributes “filter” and “filterby”.

Filtering examples and options

Filtering products by title

In this example we assume you want to filter a list of products by title:

Only show products with a certain keyword in their title

[amazon bestseller="smartphone" filterby="title" filter="iphone"]

Only show products without a certain keyword in their title

[amazon bestseller="smartphone" filterby="title" filter="iphone" filter_type="exclude"]
By default, filter_type is always set to include.

Filtering products by price

In this example we assume you want to filter a list of products by price:

Only show products with a price lower than 100 EUR/USD etc.

[amazon bestseller="smartphone" filterby="price" filter="100" filter_compare="less"]

Only show products with a price higher than 100 EUR/USD etc.

[amazon bestseller="smartphone" filterby="price" filter="100" filter_compare="more"]

Only show products with a price between 100 and 200 EUR/USD etc.

[amazon bestseller="smartphone" filterby="price" filter="100,200" filter_compare="range"]

Only show products with an exact price of 100 EUR/USD etc.

[amazon bestseller="smartphone" filterby="price" filter="100" filter_compare="equal"]

Only show products which are currently on sale

[amazon bestseller="smartphone" filterby="price" filter="offer"]

Only show products which are available

[amazon bestseller="smartphone" filterby="price" filter="available"]
By default, all filters mentioned above assume that you want to “include”
those products only. In case you want to “exclude” all products which meet the conditions above, please add filter_type and set it to exclude.

What shortcodes can be used for filtering?

Filtering can be applied when displaying multiple boxes, bestseller lists and new releases lists.


Overview of all available filtering options

“filterby” options

ValueDescription
titleTitle of the product
priceAdvertised price of the product

“filter” options

ValueDescription
Any text stringCan be used in combination with filterby="title".
Any numeric numberCan be used in combination with filterby="price". Only integers allowed, no decimal numbers.
offerCan be used in combination with filterby="price" in order to display/hide products which are on sale.
availableCan be used in combination with filterby="price" in order to display/hide products which are available.

“filter_type” options

ValueDescription
includeOnly show products which meet the given conditions (standard behaviour).
excludeOnly show products which do not meet the given conditions.

“filter_compare” options

ValueDescription
lessCan be used in combination with filterby="price" in order to set a limit on top.
moreCan be used in combination with filterby="price" in order to set a limit on bottom.
rangeCan be used in combination with filterby="price" in order to set price range.
equalCan be used in combination with filterby="price" in order to set an exact price.

Advanced information

Increasing the range of products for filtering

It’s possible to filter an even larger number of products, but only display a lower amount of products. The benefit is, that the filter can be applied to more products which might give you better results.

Therefore add the shortcode attributes items and filter_items as follows:

[amazon bestseller="smartphone" filterby="title" filter="iphone" filter_items="10" items="5"]

This way, the plugin fetches 10 products (instead of only 5) from the API and filters them by their title. Anyway, your list only shows a total amount of 5 products, but includes products that might not be included without making use of filter_items.

Important note: Due to the new Amazon API v5, the maximum amount of products returned is 10. That’s why the attribute filter_items is limited to 10 as well. More information about the new Amazon API can be found here.
When passing a browse node id (bestseller and new releases only), the API only returns a maximum amount of 10 products. This also applies to filter_items. In case you want to display or filter more than 10 products, you have to forward a keyword instead of the browse node id.
When increasing the range of products, the plugin needs to fetch, store and update more data than usual. We recommend only using the extra attribute if you’re totally unhappy with the former results.
Was this article helpful?

Related Articles

WordPress Cookie Notice by Real Cookie Banner