How to preselect filters on-page?

Welcome to Product Filter for WooCommerce article guides.

Sometimes you will want to make a link to a certain page, but with the filters already selected in the Product Filter. This is easily achieved with the query parameters you can add to your page URL. Examples follow.

Product categories can be preselected with the product_cat parameter that goes into the URL. If you use , or + these will relate to OR and AND filtering.

https://my-url.com/my-page/?product_cat=my-slug
https://my-url.com/my-page/?product_cat=my-slug,my-slug-2
https://my-url.com/my-page/?product_cat=my-slug+my-slug-2

Product tags can be preselected with the product_tag parameter that goes into the URL. If you use , or + these will relate to OR and AND filtering.

https://my-url.com/my-page/?product_tag=my-slug
https://my-url.com/my-page/?product_tag=my-slug,my-slug-2
https://my-url.com/my-page/?product_tag=my-slug+my-slug-2

Product attributes can be preselected with the pa_{attribute-name} parameter that goes into the URL. Change the {attribute-name} to your attribute slug. If you use , or + these will relate to OR and AND filtering.

https://my-url.com/my-page/?pa_my-attribute-slug=my-slug
https://my-url.com/my-page/?pa_my-attribute-slug=my-slug,my-slug-2
https://my-url.com/my-page/?pa_my-attribute-slug=my-slug+my-slug-2

Min price and max price can be preselected using the min_price and max_price.

https://my-url.com/my-page/?min_price=100
https://my-url.com/my-page/?max_price=200
https://my-url.com/my-page/?min_price=100&max_price=200

On sale filter can be preselected using the sale_products.

https://my-url.com/my-page/?sale_products=on

In stock filter can be preselected using the instock_products.

https://my-url.com/my-page/?instock_products=in
https://my-url.com/my-page/?instock_products=out
https://my-url.com/my-page/?instock_products=both

Range filters can be preselected by adding these parameters.

Prices:
https://my-url.com/my-page/?rng_min_price=100
https://my-url.com/my-page/?rng_max_price=200
https://my-url.com/my-page/?rng_min_price=100&rng_max_price=200

Taxonomies:
https://my-url.com/my-page/?rng_min_product_cat=my-slug-1&rng_max_product_cat=my-slug-2
https://my-url.com/my-page/?rng_min_pa_my-attribute-slug=my-slug-1&rng_pa_my-attribute-slug=my-slug-2

And of course, you can combine all of these. So this will work too!

https://my-url.com/my-page/?product_cat=my-slug,my-slug-2&max_price=100&sale_products=on
https://my-url.com/my-page/?product_cat=my-slug,my-slug-2&product_tag=my-tag
https://my-url.com/my-page/?pa_my-attribute-slug=my-slug&instock_products=in&sale_products=on

Leave a Reply

Your email address will not be published. Required fields are marked *

4 comments on “How to preselect filters on-page?”

  1. I love the plugin and really need the ability to preload links as described here. For some reason when I use them this way then ajax will not infinite load any products beyond the initial set loaded by the page. I got the plugin from Envato Elements before you pulled it from there, so unfortunately if this has been addressed via update then this is no solution for me. Any chance you can point me in the right direction?

    I fixed a bug all by myself that was causing an infinite loop when a filter returned zero products so I think I am capable enough D

    1. Hi, we provide support for valid licenses only. Elements isn’t it and you can read that in the Elements policy. Valid support is acquired if you purchase a license on Envato Market.