In handling add-to-cart event for woocomerce-enhanced plugin there's code that first prevents the link from working (e.preventDefault()) and then programatically changes location to that of the product: https://github.com/duracelltomi/gtm4wp/blob/10e7e9638e8750b30081ff9f5e340a370aa34657/js/gtm4wp-woocommerce-enhanced.js#L807 That's good in the general case but e.g. Shoptimizer preventDefaults itself to add a mini sidebar on product addition instead of redirect -- in this case, gtm4wp redirects on click after the sidebar pops up.
It would be great if gtm4wp could check whether default was already prevented, and if so not change document.location to prevent this interaction.
In handling add-to-cart event for woocomerce-enhanced plugin there's code that first prevents the link from working (
e.preventDefault()
) and then programatically changes location to that of the product: https://github.com/duracelltomi/gtm4wp/blob/10e7e9638e8750b30081ff9f5e340a370aa34657/js/gtm4wp-woocommerce-enhanced.js#L807 That's good in the general case but e.g. ShoptimizerpreventDefault
s itself to add a mini sidebar on product addition instead of redirect -- in this case, gtm4wp redirects on click after the sidebar pops up.It would be great if gtm4wp could check whether default was already prevented, and if so not change document.location to prevent this interaction.