Klaviyo Review Setup Issue
I added this function code to my functions.php to setup Klaviyo reviews, but when I go to verify the code Klaviyo is telling me that it can’t locate it on my WooCommerce Divi site. I added the code to my child theme. The code was provided by Klaviyo.
Respond to eve@emilyjourney.com
Website: https://celistialart.com
// *********Klaviyo Star Rating Code ******************************************************************************//
// Klaviyo Product reviews widget code
// create a function that renders a dynamic div with the correct product ID
function klaviyo_add_product_reviews_widget() {
global $product;
if (is_product() && isset($product)) {
$product_id = $product->get_id();
echo "<div id='klaviyo-reviews-all' data-id='{$product_id}'></div>";
}
}
// place the widget after the single product summary
add_action('woocommerce_after_single_product_summary', 'klaviyo_add_product_reviews_widget', 15);
// Klaviyo Star rating widget code
// create a function that renders a dynamic div with the correct product ID
function klaviyo_add_product_star_ratings_widget() {
global $product;
if (is_product() && isset($product)) {
$product_id = $product->get_id();
echo "<div class='klaviyo-star-rating-widget' data-id='{$product_id}'></div>";
}
}
// place the widget after the single product summary
add_action('woocommerce_single_product_summary', 'klaviyo_add_product_star_ratings_widget', 6);
