• Resolved kjy112

    (@kjy112)


    For whatever reason, this following code gets output twice:

    const selector = '.woocommerce-cart-form__cart-item .remove';

    I think this has to do with the template because I activate the default WP twentytwentythree and this issue doesn’t happen. Is there a way I can prevent this plugin from output this JavaScript more than once?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • I have encountered the same issue. Suppose you have a mini cart on the page, and this plugin adds the JavaScript code twice, or even more. You can resolve it by removing the mini cart or restoring the JavaScript script to its pre-update state. it should be like this https://prnt.sc/HOMvPLgifIpN

    wp-content/plugins/woocommerce-google-analytics-integration/includes/class-wc-google-gtag-js.php

    • This reply was modified 1 year, 6 months ago by Aleksey.
    Thread Starter kjy112

    (@kjy112)

    @dorogoff yes this is exactly what was happening. The mini cart on the page probably forced duplicate JS output. Your code fixed the issue. Thank you so much!

    Hello,

    I’m having this issue. It is the same you’re mentioning in this topic? Thank you.

    https://ibb.co/4pxvsfM

    Hi there @laurpm

    It seems you may be experiencing a similar issue to the one above.

    Just to clarify, did you already have a chance to try with the latest version available, and see if the issue persists, or otherwise? The latest, as of writing this, is version 1.8.6.

    Since each site setup differs, and in order to align with?forum best practices, please can you?start your own topic, and we’ll be happy to address your issue(s) separately.

    Cheers!

    Hello,

    Yes, updated to the latest version. Getting the issue only when not logged in as admin/shop administrator. Basically as a client/customer, I can see that error in the console.

    Plugin Author Tomek

    (@tomalec)

    Thank you all for reporting that, and your investigations!

    I made a quick fix for the syntax error. After the review, we should ship it with the upcoming version.

    (In the meantime, the fix from @dorogoff or the PR should help)

    I’ll also take a closer look if we could avoid duplication as well, to make it even cleaner in the future.

    • This reply was modified 1 year, 5 months ago by Tomek.
    • This reply was modified 1 year, 5 months ago by Tomek.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘JavaScript Output Twice’ is closed to new replies.