1. Dokumentation /
  2. WooCommerce Product Search /
  3. Shortcodes /
  4. [woocommerce_product_filter_rating]

[woocommerce_product_filter_rating]

This shortcode is provided with the WooCommerce Product Search extension.
This shortcode is the equivalent to the Product Filter – Rating widget. It allows to filter products by average rating. Rating Filter Shortcode Example with 3 Stars and Up The shortcode should be used within the appropriate context, i.e. where products are displayed. This can be on a shop page, a product category page or in combination with the [woocommerce_product_filter_products] shortcode. As with all live product filters that the WooCommerce Product Search extension provides, this filter is used to refine the selection of products and reduce it to a set that contains only those that match what the customer is looking for.

Usage Example

↑ Nach oben
Place these shortcodes on a page to try it out:

[woocommerce_product_filter_rating]
[woocommerce_product_filter_products]
The page will display the star rating filter on top and the shop’s products below. When you click one of the ratings, the products are updated. Here is an example output produced with the two shortcodes above placed on a page: Rating Filter Shortcode Example Output

Shortcode Attributes

↑ Nach oben
You can use the following shortcode attributes to customize the shortcode.

Heading

↑ Nach oben
  • show_heading – Whether to display the heading for this filter. "yes" (default) or "no".
  • heading – You can provide a customized heading here or omit it to use the default.
  • heading_class – This sets the CSS class of the heading element.
  • heading_element –Here you can set which HTML tag is used as the heading element. "div" is the default.
  • heading_id – This sets the HTML element ID of the heading element.

User Interface

↑ Nach oben
  • filter – Whether to enable live filters "yes" (default) or not (using "no").
  • has_rating_only – Whether to show the filter only when there are any products that have been rated. "yes" (default) or "no".

Others

↑ Nach oben
  • container_class – Allows to set the CSS class of the filter’s container.
  • container_id – Allows to set the HTML element ID of the filter’s container.