Filters are one of the two types of Hooks available in WordPress. They provide a way for functions to modify data of other functions. Please refer to the official WordPress documentation for additional information about using filters.

Here we provide a list of filters available in Customer Reviews for WooCommerce plugin.


cr_ajaxreviews_image_size

This filter can be used to customize the size of pictures uploaded by customers and displayed on product pages with Lazy Load Reviews option enabled. The filter will apply only to images that customers uploaded directly on WooCommerce product pages. The default image size is large.

Example

function my_cr_ajaxreviews_image_size( $image_size ) {
   //code to modify $image_size as required
   return $image_size;
}
add_filter( 'cr_ajaxreviews_image_size', 'my_cr_ajaxreviews_image_size', 10, 1 );

cr_ajaxreviews_show_search

This filter can be used to hide the search field displayed on product pages with Lazy Load Reviews option enabled. The search field is visible by default.

Example

function my_cr_ajaxreviews_show_search( $show_search ) {
   //code to modify $show_search as required
   return $show_search;
}
add_filter( 'cr_ajaxreviews_show_search', 'my_cr_ajaxreviews_show_search', 10, 1 );

cr_allreviews_image_size

This filter can be used to customize the size of product pictures (optionally) displayed by cusrev_all_reviews shortcode. The default image size is woocommerce_gallery_thumbnail.

Example

function my_cr_allreviews_image_size( $image_size ) {
   //code to modify $image_size as required
   return $image_size;
}
add_filter( 'cr_allreviews_image_size', 'my_cr_allreviews_image_size', 10, 1 );

cr_consent_checkbox

This filter can be used to customize the consent checkbox element displayed on the checkout page.

Example

function my_cr_consent_checkbox( $output ) {
   //code to modify $output as required
   return $output;
}
add_filter( 'cr_consent_checkbox', 'my_cr_consent_checkbox', 10, 1 );

cr_custom_questions

This filter can be used to customize visual display of answers to custom questions from aggregated review forms.

Example

function my_cr_custom_questions( $output ) {
   //code to modify $output as required
   return $output;
}
add_filter( 'cr_custom_questions', 'my_cr_custom_questions', 10, 1 );

cr_floatingtrustbadge_hide

This filter can be used to hide the floating Trust Badge from certain pages.

Example

function my_cr_floatingtrustbadge_hide() {
  $current_post_id = get_the_ID();
  // replace '526' with a post id from your site
  if( 526 === $current_post_id ) {
    // return 'true' to hide the floating trust badge
    return true;
  }
  // return 'false' to display the floating trust badge
  return false;
}
add_filter( 'cr_floatingtrustbadge_hide', 'my_cr_floatingtrustbadge_hide' );

cr_gs_product_feed_cron_limit

This filter can be used to customize how many products are processed per each WP Cron run when creating an XML Product Feed for Google Shopping. If WordPress is installed on a powerful server, the default limit (200) can be increased to enable faster creation of XML Product Feeds for Google Shopping.

Example

function my_cr_gs_product_feed_cron_limit( $limit ) {
  $limit = 500;
  return $limit;
}
add_filter( 'cr_gs_product_feed_cron_limit', 'my_cr_gs_product_feed_cron_limit' );

cr_gs_product_feed_description

This filter can be used to customize product description fields in XML Product Feed for Google Shopping. For example, if product description includes shortcodes, this filter can be used to add a call to do_shortcode function for output of the shortcodes content.

Example

function my_cr_gs_product_feed_description( $description, $product ) {
   //code to modify $description as required
   //$product is a WC_Product object
   return $description;
}
add_filter( 'cr_gs_product_feed_description', 'my_cr_gs_product_feed_description', 10, 2 );

cr_gs_product_feed_file

This filter can be used to overwrite the default filename of the XML Product Feed for Google Shopping.

Example

function my_cr_gs_product_feed_file( $filename ) {
   //code to modify $filename as required
   return $filename;
}
add_filter( 'cr_gs_product_feed_file', 'my_cr_gs_product_feed_file', 10, 1 );

cr_gs_product_feed_query

This filter can be used to adjust the query for selection of products for the XML Product Feed from the database.

Example

function my_cr_gs_product_feed_query( $query ) {
   //code to modify $query as required
   return $query;
}
add_filter( 'cr_gs_product_feed_query', 'my_cr_gs_product_feed_query', 10, 1 );

cr_gs_product_feed_product_status

This filter can be used to filter products included in XML Product Feed for Google Shopping by specific statuses. By default, only products with 'publish' status are added to the XML feed.

Example

function my_cr_gs_product_feed_product_status( $status_array ) {
   //code to modify $status_array as required
   //by default $status_array = array( 'publish' )
   return $status_array;
}
add_filter( 'cr_gs_product_feed_product_status', 'my_cr_gs_product_feed_product_status', 10, 1 );

cr_gs_product_feed_title

This filter can be used to customize product title fields in XML Product Feed for Google Shopping.

Example

function my_cr_gs_product_feed_title( $title, $product ) {
   //code to modify $title as required
   //$product is a WC_Product object
   return $title;
}
add_filter( 'cr_gs_product_feed_title', 'my_cr_gs_product_feed_title', 10, 2 );

cr_gs_product_feed_variation_status

This filter can be used to filter product variations included in XML Product Feed for Google Shopping by specific statuses. By default, only variations with 'publish' status are added to the XML feed.

Example

function my_cr_gs_product_feed_variation_status( $status_array ) {
   //code to modify $status_array as required
   //by default $status_array = array( 'publish' )
   return $status_array;
}
add_filter( 'cr_gs_product_feed_variation_status', 'my_cr_gs_product_feed_variation_status', 10, 1 );

cr_gs_product_reviews_cron_limit

This filter can be used to customize how many products are processed per each WP Cron run when creating an XML Product Reviews Feed for Google Shopping. If WordPress is installed on a powerful server, the default limit (200) can be increased to enable faster creation of XML Product Reviews Feeds for Google Shopping.

Example

function my_cr_gs_product_reviews_cron_limit( $limit ) {
  $limit = 500;
  return $limit;
}
add_filter( 'cr_gs_product_reviews_cron_limit', 'my_cr_gs_product_reviews_cron_limit' );

cr_gs_product_reviews_feed_file

This filter can be used to overwrite the default filename of the XML Product Reviews Feed for Google Shopping.

function my_cr_gs_product_reviews_feed_file( $filename ) {
   //code to modify $filename as required
   return $filename;
}
add_filter( 'cr_gs_product_reviews_feed_file', 'my_cr_gs_product_reviews_feed_file', 10, 1 );

cr_gs_product_reviews_feed_file_temp

This filter can be used to overwrite the default name of a temporary file for the XML Product Reviews Feed for Google Shopping.

function my_cr_gs_product_reviews_feed_file_temp( $filename ) {
   //code to modify $filename as required
   return $filename;
}
add_filter( 'cr_gs_product_reviews_feed_file_temp', 'my_cr_gs_product_reviews_feed_file_temp', 10, 1 );

cr_productids_separator

This filter can be used to customize or remove separator between product identifiers (e.g., GTIN, MPN or Brand) displayed on product pages in WooCommerce.

Example

function my_cr_productids_separator( $separator ) {
   //code to modify $separator as required
   return $separator;
}
add_filter( 'cr_productids_separator', 'my_cr_productids_separator', 10, 1 );

cr_qna_per_page

This filter can be used to change the default quantity of questions shown on the Q&A tab by default.

Example

add_filter( 'cr_qna_per_page', 'my_cr_qna_per_page' );
function my_cr_qna_per_page( $per_page ) {
   //code to modify $per_page
   return $per_page;
}

cr_reminder_delay

This filter can be used to override the delay for sending a review reminder configured in the settings of the plugin.

Example

function my_cr_reminder_delay( $delay, $order_id ) {
   //code to modify $delay as required
   //it is possible to read information about WooCommerce order using $order_id variable
   return $delay;
}
add_filter( 'cr_reminder_delay', 'my_cr_reminder_delay', 10, 2 );

cr_reviews_image_size

This filter can be used to customize the size of pictures uploaded by customers and displayed on product pages with Lazy Load Reviews option disabled. The filter will apply only to images that customers uploaded directly on WooCommerce product pages. The default image size is large.

Example

function my_cr_reviews_image_size( $image_size ) {
   //code to modify $image_size as required
   return $image_size;
}
add_filter( 'cr_reviews_image_size', 'my_cr_reviews_image_size', 10, 1 );

cr_reviews_polylang_merge

This filter can be used to enable or disable merging reviews corresponding to all translations of the products in Polylang. By default, the plugin will merge the reviews. If you would like to filter reviews by language (e.g., show only English reviews on an English version of the product page), you should return false from this filter.

function my_cr_reviews_polylang_merge( $merge ) {
   //return 'true' to merge reviews or 'false' to let Polylang filter reviews
   return false;
}
add_filter( 'cr_reviews_polylang_merge', 'my_cr_reviews_polylang_merge', 10, 1 );

cr_skip_reminder_generic

This filter can be used to make the plugin skip scheduling a review reminder based on a custom condition.

Example

function my_cr_skip_reminder_generic( $skip, $order_id ) {
   //code to modify $skip as required
   //it is possible to read information about WooCommerce order using $order_id variable
   return $skip;
}
add_filter( 'cr_skip_reminder_generic', 'my_cr_skip_reminder_generic', 10, 2 );

cr_skip_renewal_order

This filter can be used to make the plugin skip scheduling a review reminder for a renewal order from WooCommerce Subscriptions plugin.

Example

function my_cr_skip_renewal_order( $skip ) {
   //code to modify $skip as required
   return $skip;
}
add_filter( 'cr_skip_renewal_order', 'my_cr_skip_renewal_order', 10, 1 );

cr_topreviews_image_size

This filter can be used to customize the size of pictures uploaded by customers and displayed in 'Customer Images' section on product pages with Lazy Load Reviews option enabled. The filter will apply only to images that customers uploaded directly on WooCommerce product pages. The default image size is large.

Example

function my_cr_topreviews_image_size( $image_size ) {
   //code to modify $image_size as required
   return $image_size;
}
add_filter( 'cr_topreviews_image_size', 'my_cr_topreviews_image_size', 10, 1 );

cr_topreviews_max_count

This filter can be used to customize the number of pictures uploaded by customers and displayed in 'Customer Images' section on product pages with Lazy Load Reviews option enabled. The default number of pictures is 5.

Example

function my_cr_topreviews_max_count( $max_count ) {
   //code to modify $max_count as required
   return $max_count;
}
add_filter( 'cr_topreviews_max_count', 'my_cr_topreviews_max_count', 10, 1 );