Automattic\WooCommerce\Internal\OrderReviews

StarRating::get_labelspublic staticWC 10.8.0

Default rating labels, indexed 1-5, after the customer-facing filter.

Defaults match the long-standing WooCommerce product-review labels in templates/single-product-reviews.php so customers see consistent wording across the two review entry points.

Method of the class: StarRating{}

Returns

Array. string>

Usage

$result = StarRating::get_labels(): array;

Changelog

Since 10.8.0 Introduced.

StarRating::get_labels() code WC 11.0.1

public static function get_labels(): array {
	$labels = array(
		1 => __( 'Very poor', 'woocommerce' ),
		2 => __( 'Not that bad', 'woocommerce' ),
		3 => __( 'Average', 'woocommerce' ),
		4 => __( 'Good', 'woocommerce' ),
		5 => __( 'Perfect', 'woocommerce' ),
	);

	/**
	 * Filter the labels shown under the star-rating control.
	 *
	 * @since 10.8.0
	 *
	 * @param array<int, string> $labels Map of rating value (1-5) to label.
	 */
	$filtered = (array) apply_filters( 'woocommerce_review_order_rating_labels', $labels );

	// Keep only known 1-5 keys; fall back to defaults for any the filter dropped.
	return array_replace( $labels, array_intersect_key( $filtered, $labels ) );
}