Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • I tracked down the origin of the error and its because we are using enhanced ecommerce on our analytics tag in GTM and because we had classic and enhanced flagged on in your plugin it was adding the classic ecommerce properties into the dataLayer and GTM was complaining the number properties were being returned as strings.

    I disabled the classic ecommerce integration because I really don’t need to grab data from that object anyways it’s all available within the enhanced object and the error is gone now.

    Might be worth adding in the floatval to cast those as numbers if someone was trying to use both of those at the same time for some reason but for now I’m satisfied with this solution.

    Thanks for your time!

    ..or do you have a hook or filter I can plug into and make this change without modifying the core plugin? I am dead against modifying the core code. Also thank you very much for responding and for creating this plugin 🙂

    Thanks for pointing that out, you’re 100% right. Will you be implementing this as a change? I can revert my dev site and show you the error within the Tag Assistant but I copied and pasted them verbatim as well so there isn’t much else to see. In fact we weren’t even using any variables in GTM that even referenced those properties.

    Maybe it has to do with enabling classic and enhanced ecommerce? I noticed that when our plugin was setup both of those were flagged which is the reason those properties existed in the dataLayer in the first place.

    I dug in a bit on your GitHub and noticed the woocommerce functions you use to populate your properties in the dataLayer are being returned as strings instead of numbers.

    I changed the following in your code to make the returns a number and now I am not getting the error.

    $dataLayer["transactionTotal"] = intval($order_revenue);
    if ( $gtm4wp_is_woocommerce3 ) {
       $dataLayer["transactionShipping"] = intval($order->get_shipping_total());
    } else {
       $dataLayer["transactionShipping"] = intval($order->get_total_shipping());
    $dataLayer["transactionTax"] = intval($order->get_total_tax());
    • This reply was modified 8 months, 1 week ago by lamarkhamm.
Viewing 4 replies - 1 through 4 (of 4 total)