• Resolved 4tcmedia

    (@4tcmedia)


    Hi Team.

    Really odd one, I worked my A** off to try and find what was causing it. I have a multi-site setup, and noticed that when Apple/Google pay is activated in woocommerce settings, whenever I’d go to a single product page and select a variation and add to cart – it would add 2x (or double) what was being added. For example: select Variation – 2kg-> add to cart-> quantity 1-> the cart would update as quantity 2.

    Not great considering we don’t want to be seen or perceived as tricking or scamming our customers into purchasing more than they intended.

    If it helps with your investigation, I have done the following:

    • I confirmed this behaviour happens on the default WordPress theme (twentytwentyfive) and all other plugins disabled (not theme issue)
    • Seems to be happening on multi site (subsites), I couldn’t quite replicate it on a standard wordpress install but admittedly didn’t try for too long.
    • When Google/Apple Pay option is activated in the settings, a javascript file called tokenized-express-checkout.js is enqueued, and this seems to be causing the duplication of quantities when adding variable items to the cart.
    • I blocked this request from developer console, and the behaviour returned to the correct behaviour.
    • I disabled the Apple/Google pay option, and this file was no longer enqueued, and the problem was solved.

    I hope this helps, I’d really like to offer Apple/Google Pay to customers, but can’t risk it until this duplication issue is fixed as it could mean customers spending much more money in some cases than intended.

    You can view a walkthrough of the issue here: https://drive.google.com/file/d/13g9ZCGf1_F8eJsEkjPh5s-xJcKlG7vI2/view?usp=sharing

Viewing 13 replies - 1 through 13 (of 13 total)
  • Zee

    (@doublezed2)

    Hello 4tcmedia,

    Thank you for contacting WooCommerce support.

    I understand you’re seeing double quantities added to the cart for variable products when using Apple/Google Pay on single product pages in a multisite setup. You’ve already identified the tokenized-express-checkout.js script as the trigger.

    You did a great job narrowing that down. To troubleshoot this further, I’d like to reproduce the issue on my test site. Please share your site’s System Status Report by pasting it at https://pastebin.com and posting the link here, so I can match your settings.

    Also, please enable the “Log error messages” option under WooCommerce > Settings > Payments > WooPayments. Any related logs will appear under WooCommerce > System Status > Logs. If you spot any relevant entries, share them via Pastebin as well.

    Looking forward to your response. 🙂

    Thread Starter 4tcmedia

    (@4tcmedia)

    Pastebin: https://pastebin.com/Lp5nFncX

    No relevant logs get noted.

    Zee

    (@doublezed2)

    Hello 4tcmedia,

    Thank you for your reply.

    I’ve reviewed the report, and everything looks fine here.

    I see you’ve reactivated the plugins and are no longer using a default theme. To investigate further, please deactivate the plugins and switch to a default theme. If this isn’t possible on your live site, consider using a staging site instead.

    I tried to reproduce the issue on my test site but couldn’t, which suggests the problem may be specific to your setup. Having a staging site will allow me to troubleshoot this issue more effectively.

    Looking forward to your response. 🙂

    Thread Starter 4tcmedia

    (@4tcmedia)

    Hi there.

    I actually tested this on default twenty twenty five theme with the same issue / Did you test it on a multi site setup? it seems to be happening on a sub site of multi sites – I too could not replicate it on a normal “non multisite” setup.

    Is thre anything in that tokenization file that you feel could be causing this?

    Hi @4tcmedia,

    Thanks again for the detailed information and for sharing the screen recording; it’s incredibly helpful. I also tried to test your store directly, but it looks like a valid postcode is required to access the products, so I wasn’t able to replicate the cart behavior myself.

    From your video, it’s clear that enabling Apple/Google Pay leads to variable products being added to the cart with a quantity of 2, even when only one is selected. Disabling Apple/Google Pay or blocking the tokenized-express-checkout.js script stops this from happening, so it’s likely the issue stems from how that script interacts with your product page’s add-to-cart logic.

    The tokenized-express-checkout.js script is part of the WooPayments integration that enables Apple and Google Pay functionality. It attaches event listeners to the page to handle express checkout actions, but in some cases, especially on product pages with variations, it might inadvertently duplicate click or form submission events. This could explain why clicking “Add to Cart” triggers the action twice, especially on a multisite sub-site, which may be rendering or initializing scripts slightly differently due to pathing or context.

    To help narrow this down further, could you let me know:

    • When exactly did this issue start happening? Was it after a recent update to the WooPayments plugin, WooCommerce, or WordPress?
    • Is this a newly created multisite setup, or has it been running without this issue until recently?
    • Do you have any custom JavaScript or child theme modifications that might interact with variation selection or add-to-cart actions?

    While I wasn’t able to reproduce this issue on a standard WooCommerce site, your findings suggest that the bug may only manifest in multisite environments where the tokenized-express-checkout.js script might be triggering duplicate form submissions.

    Let me know the answers to the questions above, and we can go from there.

    Thread Starter 4tcmedia

    (@4tcmedia)

    Hi there.

    Thanks for your speedy response. I can’t actually comment on when the issue started happening, but it feels like it was quite recent, although i may have seen it earlier but just not noticed it. I don’t have any custom javascript that is listening that could be doing that.

    I activated twenty twenty five and disabled all plugins except for WooCommerce & WooPayments, and the issue still happens.

    If it helps – you can visit this site link: https://www.hungrypetwarehouse.com/adelaide-sa/product/royal-canin-exigent-savour-sensations-for-fussy-adult-cats-dry-cat-food/, when you get redirected and asked for a postcode – enter the post code 5000, it will direct you to a single product, when you change variation then add to cart, then change variation and add to cart again you’ll see the issue.

    Thanks,

    Hi @4tcmedia ,

    Thanks so much for reaching out—and I really appreciate you taking the time to dig into this.

    I was able to reproduce the issue on your site, and I noticed that you’re using a theme called Adelaide Child. It doesn’t appear to be the default Twenty Twenty-Five theme, so it’s likely a custom or third-party theme.

    Just to double-check—have you already tested the site with all plugins disabled except for WooPayment, as we suggested earlier? That step can help rule out any conflicts. If you’ve done that and the issue still shows up, especially after spotting the tokenized-express-checkout.js script causing errors, it’s worth checking whether a recent update triggered this.

    You might want to try rolling back both WooCommerce and the Stripe Payment plugin to an earlier version to see if the problem goes away. A quick way to do that is by using the WP Rollback plugin, which lets you safely switch plugin versions right from your dashboard.

    Let us know how that goes, and we’ll keep working through it with you!

    Thread Starter 4tcmedia

    (@4tcmedia)

    Hi Jonayed,

    I tested it this morning with all plugins disabled except WooCommerce & WooPayments, and default twentytwentyfive theme. I just changed it back to its normal theme as I wasn’t sure how long you guys would take to do your own test (and now knowing that the theme/thirdparty plugins are not responsible for the error), so I didn’t see the need to keep it on default theme.

    Using your suggestion – I determined that the error begins from version 9.0 of your plugin, as 8.9.2 and previous do not have the error. I hope this helps? (Woocommerce was its current version).



    Thread Starter 4tcmedia

    (@4tcmedia)

    Hi there.

    I was also able to find something that seems to be firing each time a variation is selected. You can see the video here:

    https://drive.google.com/file/d/1GGrYdnvMLwVRGRDwCjgX75XAdtMMpBc8/view?usp=drive_link

    I think we’ve got this pretty locked down! hopefully you can fix.

    Thread Starter 4tcmedia

    (@4tcmedia)

    Also – Can confirm that it seems the https://www.hungrypetwarehouse.com/adelaide-sa/wp-json/wc/store/v1/cart/add-item?currency=AUD&_locale=user is firing each time the variation is switched – which causes our problem 🙂

    Zee

    (@doublezed2)

    Hello 4tcmedia,

    Thank you for your reply.

    You did a great job finding this trigger. To troubleshoot further, I recommend creating a clone of the site within the same Multisite setup, then deactivating all other plugins (except WooCommerce and WooPayments) and switching to a default theme. This will help us test the issue more effectively from our end.

    Please share the URL when the clone site is ready.

    Best regards.

    • This reply was modified 1 year, 2 months ago by Zee. Reason: Rewrite
    Thread Starter 4tcmedia

    (@4tcmedia)

    Hi there. thanks for your repsnse.

    Unfortunately I have a business to run and i can’t spend more time on this – I think i’ve done more than others, and shown enough evidence that from WooPayments 9.0 this issue happens. I think your team is better to suited to create a test environment to tackle this. Any multisite – with WooCommerce & WooPayments will be effected.

    I think it should be possible to analyse the changes from your 8.9.2 to 9.0 to be able to figure out the problem.

    I’ll await for an update with a fix or it just might be better for us to go with a different plugin (there are a few out there), but wouldn’t really look good for WC if they’re own payment plugin has issues.

    Hi @4tcmedia,

    Thank you for the update and for clarifying your position. I completely understand your concern and your decision to focus on your business. That said, I’d like to clarify that we follow certain protocols when troubleshooting issues like this, one of which involves first isolating the issue within the merchant’s environment before attempting to replicate it on our end.

    To ensure you get the support you need, a more effective approach—rather than stepping away—would be to submit the issue directly on GitHub: WooCommerce Payments GitHub Issues.
    This allows the development team to take a closer look, and opens the door for other contributors to help replicate the issue or offer insights, which can also benefit others facing similar problems.

    Thank you again for your time and effort so far. In the meantime, if you could spare a few moments to leave an honest review for the plugin, we’d really appreciate it—your feedback plays a key role in helping us improve: Leave a Review.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Enabling Google/Apple Pay adds duplicate items to cart on variable products’ is closed to new replies.