',
- esc_attr( $classes_and_styles['classes'] ),
- esc_attr( $classes_and_styles['styles'] ),
+ $wrapper_attributes,
$this->render_anchor(
$product,
$this->render_on_sale_badge( $product, $parsed_attributes ),
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php
index 1d729677171..64365867a83 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRating.php
@@ -202,13 +202,18 @@ class ProductRating extends AbstractBlock {
10
);
+ $wrapper_attributes = get_block_wrapper_attributes(
+ array(
+ 'class' => 'wc-block-components-product-rating wc-block-grid__product-rating ' . esc_attr( $text_align_styles_and_classes['class'] ?? '' ) . ' ' . esc_attr( $styles_and_classes['classes'] ),
+ 'style' => esc_attr( $styles_and_classes['styles'] ?? '' )
+ )
+ );
+
return sprintf(
- '
- %4$s
+ '
+ %2$s
',
- esc_attr( $text_align_styles_and_classes['class'] ?? '' ),
- esc_attr( $styles_and_classes['classes'] ),
- esc_attr( $styles_and_classes['styles'] ?? '' ),
+ $wrapper_attributes,
$rating_html
);
}
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php
index 05dfff98d0f..cb5291628f9 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingCounter.php
@@ -132,7 +132,7 @@ class ProductRatingCounter extends AbstractBlock {
* @param int $count Total number of ratings.
* @return string
*/
- $filter_rating_html = function( $html, $rating, $count ) use ( $post_id, $product_rating, $product_reviews_count, $is_descendent_of_single_product_block, $is_descendent_of_single_product_template ) {
+ $filter_rating_html = function ( $html, $rating, $count ) use ( $post_id, $product_rating, $product_reviews_count, $is_descendent_of_single_product_block, $is_descendent_of_single_product_template ) {
$product_permalink = get_permalink( $post_id );
$reviews_count = $count;
$average_rating = $rating;
@@ -193,17 +193,21 @@ class ProductRatingCounter extends AbstractBlock {
10
);
+ $wrapper_attributes = get_block_wrapper_attributes(
+ array(
+ 'class' => 'wc-block-components-product-rating-counter wc-block-grid__product-rating-counter ' . esc_attr( $text_align_styles_and_classes['class'] ?? '' ) . ' ' . esc_attr( $styles_and_classes['classes'] ),
+ 'style' => esc_attr( $styles_and_classes['styles'] ?? '' ),
+ )
+ );
+
return sprintf(
- '
- %4$s
+ '
+ %2$s
',
- esc_attr( $text_align_styles_and_classes['class'] ?? '' ),
- esc_attr( $styles_and_classes['classes'] ),
- esc_attr( $styles_and_classes['styles'] ?? '' ),
+ $wrapper_attributes,
$rating_html
);
}
return '';
}
}
-
diff --git a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingStars.php b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingStars.php
index 1f4b1f487be..15a001c6a14 100644
--- a/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingStars.php
+++ b/plugins/woocommerce/src/Blocks/BlockTypes/ProductRatingStars.php
@@ -149,13 +149,18 @@ class ProductRatingStars extends AbstractBlock {
10
);
+ $wrapper_attributes = get_block_wrapper_attributes(
+ array(
+ 'class' => 'wc-block-components-product-rating wc-block-grid__product-rating ' . esc_attr( $text_align_styles_and_classes['class'] ?? '' ) . ' ' . esc_attr( $styles_and_classes['classes'] ),
+ 'style' => esc_attr( $styles_and_classes['styles'] ?? '' ),
+ )
+ );
+
return sprintf(
- '
- %4$s
+ '
+ %2$s
',
- esc_attr( $text_align_styles_and_classes['class'] ?? '' ),
- esc_attr( $styles_and_classes['classes'] ),
- esc_attr( $styles_and_classes['styles'] ?? '' ),
+ $wrapper_attributes,
$rating_html
);
}