prevent default event for buy it now button and retrigger it afterwards

Highlighted
New Member
5 0 0

i want to stop buy it now button from redirecting and execute some code and afterwards retrigger the buy it now functionnality 

i have used preventDefault but it i not working

Screenshot_1.png

nothing is showing in console and when i click the button it redirects to checkout page

0 Likes
Highlighted
Excursionist
26 1 2

Hi Talha,

e.preventDefault() would work on some cases, but not on others.

Instead of preventDefault() try with:

e.stopImmediatePropagation() 

Hope that would help!

If you need custom modification on store - contact us
If we were helpful then please Like and Accept Solution .
SkyDream Web
https://skydream.info
1 Like
Highlighted
New Member
5 0 0

hy i have checked this code also, but it is not working.

image.png

the click event is firing and i can see log statement but it still redirects to checkout page.

there are some ajax requests also that are being sent by this button one of them is

wallets/checkout.json

0 Likes