I am attempting to add the Yotpo Rewards Checkout widget to the WooCommerce checkout form in WordPress right below the area where the total is shown for the transaction for a better user experience. However, when I add the script that I am currently using to functions.php it shows the widget for a couple of seconds and then it disappears. The Yotpo team seems stumped on this and have said the loader script isn’t rendering correctly but I’m seeing the correct amount of rewards points every time, even when I adjust the points, and I’ve tried adding the loader script right in the code where the widget code is as well and it still disappears. I’ve also looked in the DOM and can confirm that the loader script is there with the correct information. Here is my current implementation in functions.php:
function add_yotpo_widget_to_checkout() {
echo '<div><script src="https://cdn-widgetsrepository.yotpo.com/v1/loader/<our-key>" async></script><div class="yotpo-widget-instance" data-yotpo-instance-id="<our-instance-id>"></div></div>';
}
add_action('woocommerce_review_order_before_submit', 'add_yotpo_widget_to_checkout');
As stated above, the widget does show up and is working fine but disappears after a couple of seconds.