Hey @Maria Molina
Does your code snippet look something like this?
add_action('woocommerce_after_single_product_summary', 'klaviyo_reviews_widget', 15);
function klaviyo_reviews_widget() {
?>
<div id="klaviyo-reviews-widget"></div>
<script type="text/javascript">
Klaviyo.load({ widget: 'reviews', productId: '<?php echo get_the_ID(); ?>' });
</script>
<?php
}
Troubleshooting Tips
Ensure jQuery is Loaded:
- The Klaviyo Reviews widget relies on jQuery. Ensure that jQuery is loaded on your site. The Avada theme should already include jQuery, but verify this in your theme settings.
Check for JavaScript Errors:
- Open your browser's developer tools (F12 or right-click and select "Inspect") and check the console for any JavaScript errors that might be preventing the widget from loading.
Manually Insert the Widget Code:
- If the Code Snippets plugin is not working, try manually inserting the widget code into your theme’s files. You can add the code directly to your theme's
functions.php
file or use a child theme to avoid overwriting changes during theme updates.
-
For example, add the following code to the functions.php
file:
function add_klaviyo_reviews_widget() {
if (is_product()) {
?>
<div id="klaviyo-reviews-widget"></div>
<script type="text/javascript">
Klaviyo.load({ widget: 'reviews', productId: '<?php echo get_the_ID(); ?>' });
</script>
<?php
}
}
add_action('wp_footer', 'add_klaviyo_reviews_widget');
If none of these work, I would suggest you contact klaviyo support for assistance. Provide them with details about your theme, the steps you have taken, and any error messages you have encountered.
I hope this helps
Cheers
Arpit