Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Location change on add-to-cart #271

Open
kzemek opened this issue Jun 9, 2023 · 1 comment
Open

Location change on add-to-cart #271

kzemek opened this issue Jun 9, 2023 · 1 comment

Comments

@kzemek
Copy link

kzemek commented Jun 9, 2023

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:

document.location.href = dom_productdata.getAttribute( 'data-gtm4wp_product_url' );
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.

@duracelltomi
Copy link
Owner

Do you mean something like this?
079b172

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants