Skip to main content
Contributor II
Nov 5, 2026 10:41 PM UTC
Solved

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);
 

Temi O.
Temi O.Answer
Community Manager
Nov 9, 2026 3:55 PM UTC

Hi ​@epera ,

Thanks for sharing the code and your site. The snippets you added do match Klaviyo’s WooCommerce instructions, so adding them to your child theme’s functions.php is a valid approach.

The main thing to check with Divi is whether the single-product template actually runs the WooCommerce hooks in the code. These hooks must run for the widgets to appear, and a custom product template may use a different layout.

On a live product page, right-click and choose View page source, then search for klaviyo-reviews-all and klaviyo-star-rating-widget:

  • If neither appears, the functions are not being output on that page. Check that the child theme is active, clear any site/CDN cache, and confirm the Divi product template supports those WooCommerce hooks. If it does not, use another installation method in Klaviyo’s WooCommerce guide, such as its shortcode approach, or have a developer adapt the placement for the Divi template.

  • If they appear, confirm each element has the correct product ID in its data-id attribute. Klaviyo’s onsite JavaScript must also load on the page for the widget to render.

The WooCommerce guide includes the hook-based and shortcode-based installation steps: How to install Klaviyo Reviews for WooCommerce.


I hope this helps!

 


Temi@Klaviyo​

1 reply

Temi O.
Community Manager
Temi O.Answer
Community Manager
Nov 9, 2026 3:55 PM UTC

Hi ​@epera ,

Thanks for sharing the code and your site. The snippets you added do match Klaviyo’s WooCommerce instructions, so adding them to your child theme’s functions.php is a valid approach.

The main thing to check with Divi is whether the single-product template actually runs the WooCommerce hooks in the code. These hooks must run for the widgets to appear, and a custom product template may use a different layout.

On a live product page, right-click and choose View page source, then search for klaviyo-reviews-all and klaviyo-star-rating-widget:

  • If neither appears, the functions are not being output on that page. Check that the child theme is active, clear any site/CDN cache, and confirm the Divi product template supports those WooCommerce hooks. If it does not, use another installation method in Klaviyo’s WooCommerce guide, such as its shortcode approach, or have a developer adapt the placement for the Divi template.

  • If they appear, confirm each element has the correct product ID in its data-id attribute. Klaviyo’s onsite JavaScript must also load on the page for the widget to render.

The WooCommerce guide includes the hook-based and shortcode-based installation steps: How to install Klaviyo Reviews for WooCommerce.


I hope this helps!

 


Temi@Klaviyo​