Archived topic
iOS Woocommerce Double Click
8 replies · Started by Ian on February 17, 2022
I noticed Woocommerce requires a double click on Single Product buttons. I did find Tom referencing this as a temp solution: https://generatepress.com/forums/topic/gp-woocommerce-must-click-add-to-cart-twice-on-mobile/#post-1315093
1. Has there been an official fix / update?
2. Should the Element > Display Rules > Targeting = Product / All Products?
Hi there,
It should've been fixed for sure. We haven't had other reports on this since then - unless it's happening again...
Do you experience the issue on our site here?
https://gpsites.co/seller/
Hi Leo. It is indeed happening at: https://gpsites.co/seller/
It's happening inside the product level page "Add to Cart". Does not affect the Add to Cart on the homepage blocks.
Using iOS on Safari.
Ahh ok I can replicate it and will log it as a bug.
I wonder if this code still works for a temporary fix:
https://generatepress.com/forums/topic/gp-woocommerce-must-click-add-to-cart-twice-on-mobile/#post-1315093
It can be added as a hook element withwp_footer:
https://docs.generatepress.com/article/hooks-element-overview/
https://docs.generatepress.com/article/wp_footer/
Yes, that's the script that I am running and it seems to work.
May I check if this is the right targeting based on what you see?
Element > Display Rules > Targeting = Product / All Products?
Yup that's the correct display rule :)
Thx! When the fix rolls out, would you mind replying here so I get notified. Would like to remove that piece of code once the official fix is released! TIA!
I will try my best to remember :)
Hey,
This is actually a known bug on iOS that sometimes occurs when using the Delay JS. This bug causes links to not work until they are clicked twice.
I fixed the issue adding a Hook element:
Hook: wp_head
Location: Entire Site
<script src="https://cdnjs.cloudflare.com/ajax/libs/fastclick/0.6.0/fastclick.min.js" integrity="sha512-oljyd1wg75alHReTpDvNIQ4Yj1wZwGxxZhJhId3vr2dKY+26/r/wmMrImwDgin03+7wxyhX+adOQB/2BTvO5tQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>if ('addEventListener' in document) {document.addEventListener('DOMContentLoaded', function() {FastClick.attach(document.body);}, false);}</script>
More details here => https://perfmatters.io/docs/delay-javascript/#ios-double-click