Hi, I’m now trying to insert conversion code for add-to-cart function.
To do that I’m using the code below.
//Add to cart
add_action('woocommerce_add_to_cart','naver_add_to_cart_conversion');
function naver_add_to_cart_conversion( $product_data ){
$price_added_to_cart = $prodcut_data -> get_price() ;
?>
<script type="text/javascript" src="https://wcs.naver.net/wcslog.js"></script>
<script type="text/javascript">
var _nasa={};
_nasa["cnv"] = wcs.cnv("3","<?php echo $price_added_to_cart ?>");
</script>
}
<?php
This code is used for “NAVER Analytics” to track down the conversion on add-to-cart, register, and purchase.
However, the problem is that the widget that used to appear after a product was successfully added to cart does not appear. Instead the loading icon on add-to-cart button keeps running and does not stop.
If I refresh the page, it is possible to check that the item was added successfully due to the click on add-to-cart button.
I think the javascript code is causing this problem, but not sure..
Please help me settling this issue.
*Currently I deleted all the customized code so that the site works smoothly.