From 3265f594d877ef2c5a0f2097183dcb6fe8343ec0 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 8 Mar 2018 13:03:58 +0000 Subject: [PATCH] Only add schema for ratings when enabled. --- includes/class-wc-structured-data.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/class-wc-structured-data.php b/includes/class-wc-structured-data.php index 7bc43009864..4767e3b5487 100644 --- a/includes/class-wc-structured-data.php +++ b/includes/class-wc-structured-data.php @@ -264,7 +264,7 @@ class WC_Structured_Data { $markup['offers'] = array( apply_filters( 'woocommerce_structured_data_product_offer', $markup_offer, $product ) ); } - if ( $product->get_review_count() ) { + if ( $product->get_review_count() && 'yes' === get_option( 'woocommerce_enable_review_rating' ) ) { $markup['aggregateRating'] = array( '@type' => 'AggregateRating', 'ratingValue' => $product->get_average_rating(),