Automattic\WooCommerce\Internal\OrderReviews

ItemEligibility::render_variation_summarypublic staticWC 10.9.0

Echo the variation summary snapshot for a review comment, when present.

Wired onto woocommerce_review_before_comment_text the snapshot stored in _review_variation_summary (set by the Customer Review Request submission flow) appears immediately above the review body on the single-product Reviews tab. Comments without the meta render unchanged.

Method of the class: ItemEligibility{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = ItemEligibility::render_variation_summary( $comment ): void;
$comment(WP_Comment) (required)
Review comment being rendered.

Changelog

Since 10.9.0 Introduced.

ItemEligibility::render_variation_summary() code WC 10.9.1

public static function render_variation_summary( \WP_Comment $comment ): void {
	$summary = (string) get_comment_meta( (int) $comment->comment_ID, self::VARIATION_SUMMARY_META_KEY, true );
	if ( '' === $summary ) {
		return;
	}

	echo '<p class="woocommerce-review__variation-summary">' . esc_html( $summary ) . '</p>';
}