Need to clear all variable value once submit Add to cart

ch_naresh207
Giga Expert

I need to clear all the catalog item variable values once the user clicked on addtocart. so that the item would be added to cart. next time if the user clicks addtocart button by mistake. mandatory field check error will get displayed since we are clearing the values.

Please let me know any feasibility on this

1 ACCEPTED SOLUTION

function onLoad() {  


     


document.getElementById('add_to_cart_button').addEventListener("click", function(){  


  reloadWindow(window);  


});  


}  



this code is working fine


View solution in original post

7 REPLIES 7

Hello - this might be a silly question, but where exactly did you put this script, please? I need the same solution, but I don't know where to put the script. 

 

Many thanks

rswhite
Kilo Contributor

Hi Jonny27,

 

Did you ever get the answer to your question about where to put this script?  I have tried in a client script but it's not working unless I'm not doing it correctly.

 

Thanks

Rachel

jonny27
Giga Contributor

Morning Rachel. 

 

I'm afraid not - I'm none the wiser! If you find out, could you let me know, please?

 

Many thanks