WordPress at Your Fingertips
function is not described

WC_Product_Data_Store_CPT::reviews_allowed_query_where() public WC 3.2.0

Add ability to get products by 'reviews_allowed' in WC_Product_Query.

{} It's a method of the class: WC_Product_Data_Store_CPT{}

No Hooks.

Return

String.

Usage

$WC_Product_Data_Store_CPT = new WC_Product_Data_Store_CPT();
$WC_Product_Data_Store_CPT->reviews_allowed_query_where( $where, $wp_query );
$where(string) (required)
Where clause.
$wp_query(WP_Query) (required)
WP_Query instance.

Changelog

Since 3.2.0 Introduced.

Code of WC_Product_Data_Store_CPT::reviews_allowed_query_where() WC 5.7.0

public function reviews_allowed_query_where( $where, $wp_query ) {
	global $wpdb;

	if ( isset( $wp_query->query_vars['reviews_allowed'] ) && is_bool( $wp_query->query_vars['reviews_allowed'] ) ) {
		if ( $wp_query->query_vars['reviews_allowed'] ) {
			$where .= " AND $wpdb->posts.comment_status = 'open'";
		} else {
			$where .= " AND $wpdb->posts.comment_status = 'closed'";
		}
	}

	return $where;
}