WC_Embed::get_ratings()
Prints the markup for the rating stars.
Description Description
Source Source
File: includes/class-wc-embed.php
public static function get_ratings() {
// Make sure we're only affecting embedded products.
if ( ! self::is_embedded_product() ) {
return;
}
$_product = wc_get_product( get_the_ID() );
if ( $_product && $_product->get_average_rating() > 0 ) {
?>
<div class="wc-embed-rating">
<?php
printf(
/* translators: %s: average rating */
esc_html__( 'Rated %s out of 5', 'woocommerce' ),
esc_html( $_product->get_average_rating() )
);
?>
</div>
<?php
}
}
Changelog Changelog
| Version | Description |
|---|---|
| 2.4.11 | Introduced. |