Product add to cart improvement
7 years 8 months ago - 7 years 8 months ago #302370
by kyratn
Product add to cart improvement was created by kyratn
Hi,
We see sometimes that product/variant has been added twice to shopping cart. Seems it's because of user click add to cart button twice accidentally or maybe slow internet response...
Is there a way to add some kinda check and prevent button to be clicked again until first click adds product to cart?
I see that button gets "add_in_progress" class so there must be some trigger we could use and disable button until it's finished?
Please advise.
Thank you
We see sometimes that product/variant has been added twice to shopping cart. Seems it's because of user click add to cart button twice accidentally or maybe slow internet response...
Is there a way to add some kinda check and prevent button to be clicked again until first click adds product to cart?
I see that button gets "add_in_progress" class so there must be some trigger we could use and disable button until it's finished?
Please advise.
Thank you
Last edit: 7 years 8 months ago by kyratn.
Please Log in or Create an account to join the conversation.
7 years 8 months ago #302405
by nicolas
Replied by nicolas on topic Product add to cart improvement
Hi,
That's an interesting idea.
Change the code:
to:
in the file media/com_hikashop/js/hikashop.js
Note however that the drawback I see is that if the first add to cart request fails for some reason (network issue for example), you'll render the add to cart button unsuable unless the user refreshes the page, so that might not be such a good idea.
That's an interesting idea.
Change the code:
Code:
if(className) o.addClass(el, className);
Code:
if(className){
if(o.hasClass(el, className)) {
return;
}
o.addClass(el, className);
}
Note however that the drawback I see is that if the first add to cart request fails for some reason (network issue for example), you'll render the add to cart button unsuable unless the user refreshes the page, so that might not be such a good idea.
Please Log in or Create an account to join the conversation.
Time to create page: 0.162 seconds