• Resolved fstefan

    (@fstefan)


    Hello,

    we created a shop with WooCommerce and Toolset. For tracking we installed your plugin and it works perfect except the add to cart event for variation products. When adding a variation product to the cart the slide in cart of the Astra theme don’t show (it works perfect for simple products) and we get this error message:

    Uncaught Error: Google Analytics for WooCommerce: Could not read product ID from the button given in added_to_cart event. Check whether WooCommerce Core events or elements are malformed by other extensions. at C.document.body.onadded_to_cart (main.js?ver=50c6d17…:1:4726) at Object.trigger (jquery.min.js?ver=3.7.1:2:70175) at HTMLBodyElement. (jquery.min.js?ver=3.7.1:2:70726) at Function.each (jquery.min.js?ver=3.7.1:2:3129) at ce.each (jquery.min.js?ver=3.7.1:2:1594) at ce.trigger (jquery.min.js?ver=3.7.1:2:70701) at Object.success (single-product-ajax-…js?ver=4.8.0:1:1648) at c (jquery.min.js?ver=3.7.1:2:25304) at Object.fireWith as resolveWith at l (jquery.min.js?ver=3.7.1:2:77782)

    Could you please provide some solutions to help resolve the issue?

    Thank you in advance,
    Stefan

Viewing 10 replies - 1 through 10 (of 10 total)
  • Hey there, @fstefan! Thanks for contacting us. I’m happy to help you.

    This error you are seeing might be due to conflicts or issues with how WooCommerce’s core events or HTML elements are being modified by other extensions or customizations.

    Can you please run a conflict test to check this?

    To test, you’ll first want to change the theme on your site to Storefront, then check to see if the issue is still present. If that resolves the issue, you’ll want to get in touch with your theme’s developer and see if they have an update or fix for you.

    If changing the theme doesn’t help, you’ll want to deactivate all plugins except for WooCommerce (this includes deactivating plugins like Elementor, theme plugins, custom code plugins, etc) and take a look. If that fixes the problem, re-enable the other plugins one by one (gradually), checking after each, to see where the issue is coming from.

    — Be sure you have a good backup in place of your full site and database. You can ask your host for backup functionality or you can consider using a service like Jetpack. If something goes wrong, you will be able to restore it.

    — It is important to consider as well a staging functionality in case you would not like to touch your production site (you can ask your host if they offer this service), or you can use WP Staging for quickly spinning up a new test site.

    You can find more about this in this guide.

    Please let us know about your findings.

    Have a wonderful day!

    Thread Starter fstefan

    (@fstefan)

    We did tests with another theme and your plugin worked as expected! So we contacted the Astra theme support and they did some tests also. They found out, that with your plugin activated but no “Google Analytics Tracking ID” entered everything works as expected. When adding a variation product to the cart the slide in cart appears.
    When adding the tracking ID (G-…) under Woocommerce > Settings > Integration the error appears again, slide-in cart don’t show and we get the error message that I originally reported.

    So I’ld like to ask if this is a known issue of the plugin or if you can help with further advice as it seems that the error is somehow plugin related?

    Hey, @fstefan!

    Do you mind sharing more details so we can better understand the issue?

    Which theme did you use to test?

    We did tests with another theme and your plugin worked as expected!

    Does that mean that with another theme, things worked with Google Analytics Tracking ID added?

    Or does it only work if there is no Google Analytics Tracking ID, like with Astra?

    Looking forward to your reply.

    Have a wonderful day!

    Thread Starter fstefan

    (@fstefan)

    Good point. Our shop runs with the Astra theme. For testing I used the Twenty Twenty-Four theme.

    With Twenty Twenty-Four the plugin works with AND without the Google Analytics Tracking ID.
    In Astra it only works without the Google Analytics Tracking ID. The strange thing is, that it works with simple products and the error only appears with variable products.

    Can you please provide any hint on how to fix this?

    Plugin Support omarfpg a11n

    (@omarfpg)

    Hi @fstefan,

    Thank you for the additional details. This seems to be a theme conflict issue. To learn more, can you tell us when did you notice this issue started happening? I’ve found a similar report dating back to 2.1.5. Looking at the plugin’s changelog I found this change on 2.1.4:

    = 2.1.4 – 2024-07-02 =

    • Dev – Upgrade npm dependencies.
    • Dev – Upgrade to Node.js 20.
    • Tweak – Add checks and explicit errors when cart buttons are missing data.

    With this in mind, could you test this by temporarily reverting to 2.1.3 and seeing if the issue persists with Astra and Google Analytics for WooCommerce 2.1.3? This can help determine at which point the issue arised, and then third-party theme developers can focus on it to make sure their themes are compatible with the latest version of our plugin!

    I hope this helps so far.

    Cheers!
    -OP

    I noticed the same console error when adding variable products to the cart, using Astra. I temporarily reverted Google Analytics for WooCommerce to 2.1.3. This removed the console error.

    @fstefan: Any updates? Did you already reach out to Astra/Brainstorm?

    Plugin Author Tomek

    (@tomalec)

    Hi, I strongly recommend running 2.1.4+. We added this error message there, to help you identify the issue. With the versions <2.1.4, the issue you face would still persist – our extension will not get the product ID and will not add product data for tracking – but without the error message it could go unnoticed.

    with your plugin activated but no “Google Analytics Tracking ID” entered everything works as expected

    Without your Google Analytics Tracking ID entered, our plugin is effectively disabled. So, I’d say it’s rather a conflict, and the Astra theme is tempering with an add-to-cart button.

    I have the same problem, but for removing item in the cart and i use Themify Shoppe Theme. It works when i deactivate Google Anayltics Plugin or change the theme to twenty-one pilots. Up until now this hasn’t been fixed

    Plugin Support ckadenge (woo-hc)

    (@ckadenge)

    Hi @joshmasagana,

    To align with?forum best practices, please create a new topic so that we can address your issue(s) separately.

    You can create a new thread here.
    Thanks for understanding!

    Plugin Support Feten L. a11n

    (@fetenlakhal)

    Hi there!

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.