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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Naresh,



Can you explain exact scenario for this?


Clearing out all the variables for this catalog item would require querying the Variable Ownership table on the fly and delete the records.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

ch_naresh207
Giga Expert

Thanks for your replay.



Issue is resolved . Just I used on client script-submit : location.reload(true);



whenever user submit Add to Cart then automatically Catalog form is reloading...


Hi Naresh,



Any update on this?


Can you mark answer as correct, helpful and hit like if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

function onLoad() {  


     


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


  reloadWindow(window);  


});  


}  



this code is working fine