Functions

All of the following functions take an optional array as their function argument, holding options equivalent to those that the Shortcodes allow. Please refer to documentation of the corresponding shortcode for details on the accepted attributes.

All functions return a string which can be used to render the corresponding HTML in a PHP template.

woocommerce_product_search()

↑ Back to top

Renders a product search form which is returned as HTML and loads required resources.

woocommerce_product_filter()

↑ Back to top

Renders a product filter form which is returned as HTML and loads required resources.

Use it within a shop or category page template or use the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_filter_context()

↑ Back to top

Used to establish a filter context based on selected taxonomies and terms. This function is non-rendering.

This should be used to set the context that determines which products can be included and displayed with the woocommerce_product_filter_products().

woocommerce_product_filter_products()

↑ Back to top

Renders the products section based on the shop loop. This should be used only once on a page to render the target where the results of the live filters are displayed.

The function can be used to render the products in a template instead of using a default shop or product category page template.

woocommerce_product_search_filter_attribute()

↑ Back to top

Renders a product attribute filter which is returned as HTML and loads required resources.

Use the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed or use it within the context of a shop page or product category page.

woocommerce_product_search_filter_brand()

↑ Back to top

Renders a brand category filter which is returned as HTML and loads required resources.

This should be used within a shop or category page template or use the woocommerce_product_filter_brand() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_category()

↑ Back to top

Renders a product category filter which is returned as HTML and loads required resources.

This should be used within a shop or category page template or use the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_price()

↑ Back to top

Renders a product price filter which is returned as HTML and loads required resources.

Use it within a shop or product category page template or use the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_rating()

↑ Back to top

Renders a product rating filter, returns HTML and loads required resources.

This can also be used with the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed or use it in a shop or product category page template.

woocommerce_product_search_filter_sale()

↑ Back to top

Renders a product filter for products on sale which is returned as HTML and loads the required resources.

Use it on a shop or product category page template or with the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_stock()

↑ Back to top

Renders a product filter for available products (in stock or on backorder) which is returned as HTML and loads the required resources.

Use it on a shop or product category page template or with the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_tag()

↑ Back to top

Renders a product tag filter which is returned as HTML and loads required resources.

Use it within a shop or category page template or use the woocommerce_product_filter_products() function which provides the target where the results of the live filter are displayed.

woocommerce_product_search_filter_reset()

↑ Back to top

Renders a button to reset all live filters, returned as HTML.

Use it with live product filters to provide a convenient means of clearing all active filters.


The following functions are used to determine whether the WooCommerce standard [products] shortcode should be filtered by the search engine or not.

woocommerce_product_search_filter_shortcode_products()

↑ Back to top

This function is used to enable or disable filtering of the [products] shortcode.

Arguments:

  • $atts array takes a single option indexed as ‘enable’; true enables filtering, disables otherwise

woocommerce_product_search_filter_shortcode_products_enable()

↑ Back to top

This function enables filtering of the [products] shortcode.

woocommerce_product_search_filter_shortcode_products_disable()

↑ Back to top

This function disables filtering of the [products] shortcode.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.