- Posts: 36
- Thank you received: 1
- Forum
- Support questions
- WooPrice Calculator (Pro)
- [SOLVED] prevent double click "add to basket" button
×
WooPrice Calculator PRO
[SOLVED] prevent double click "add to basket" button
- Simone
-
4 years 13 hours ago #132
by Simone
Simone replied the topic: [SOLVED] prevent double click "add to basket" button
Good Job, thanks for share! 
S

S
Please Log in or Create an account to join the conversation.
- Yourwp
-
Topic Author
- Offline
Less
More
4 years 1 day ago #131
by Yourwp
Yourwp replied the topic: [SOLVED] prevent double click "add to basket" button
aaaaah, it works!!
for all those non php geeks:
i added this to the functions.php in my theme to add the script to the footer.
function onlyonce(){ ?>
<script>
jQuery(document).ready(function($){
$('.cart').one('submit', function() {
$(this).find('button[type="submit"]').attr('disabled','disabled');
});
});
</script>
<?php }
add_action('wp_footer', 'onlyonce');
for all those non php geeks:
i added this to the functions.php in my theme to add the script to the footer.
function onlyonce(){ ?>
<script>
jQuery(document).ready(function($){
$('.cart').one('submit', function() {
$(this).find('button[type="submit"]').attr('disabled','disabled');
});
});
</script>
<?php }
add_action('wp_footer', 'onlyonce');
Please Log in or Create an account to join the conversation.
- Simone
-
4 years 1 day ago #122
by Simone
Simone replied the topic: [SOLVED] prevent double click "add to basket" button
I saw you set redirect to checkout after adding product, I was going to suggest you now... 
To disable the button after one click you could add a jQuery function like this:
Regards,
Simone

To disable the button after one click you could add a jQuery function like this:
$(‘.cart’).one('submit', function() {
$(this).find(‘button[type="submit"]').attr('disabled','disabled');
});
Regards,
Simone
Please Log in or Create an account to join the conversation.
- Yourwp
-
Topic Author
- Offline
Less
More
- Posts: 36
- Thank you received: 1
4 years 2 days ago #112
by Yourwp
Yourwp replied the topic: [SOLVED] prevent double click "add to basket" button
Hello,
i installed the plugin, but that is not working.
Now it even acts more weird
I really think the plugin should disable the button when the button is clicked and all validation is ok.
tx in advance!
i installed the plugin, but that is not working.
Now it even acts more weird

I really think the plugin should disable the button when the button is clicked and all validation is ok.
tx in advance!
Please Log in or Create an account to join the conversation.
- Yourwp
-
Topic Author
- Offline
Less
More
- Posts: 36
- Thank you received: 1
4 years 2 days ago #108
by Yourwp
Yourwp replied the topic: [SOLVED] prevent double click "add to basket" button
Ok, i will check.
I just need to make sure that when they start a new calculation, the product can be added again.
tx!!
I just need to make sure that when they start a new calculation, the product can be added again.
tx!!
Please Log in or Create an account to join the conversation.
- Simone
-
4 years 2 days ago #107
by Simone
Simone replied the topic: [SOLVED] prevent double click "add to basket" button
Ok, so you don't want to allow users to add more than one unit of quantity per product, right?
In this case WPC PRO doesn't do the job, but you can set a max quantity per product (to 1) in woocommerce settings with a plugin.
I found this, which works good: it.wordpress.org/plugins/woocommerce-max-quantity/
Regards,
Simone
In this case WPC PRO doesn't do the job, but you can set a max quantity per product (to 1) in woocommerce settings with a plugin.
I found this, which works good: it.wordpress.org/plugins/woocommerce-max-quantity/
Regards,
Simone
Please Log in or Create an account to join the conversation.
- Yourwp
-
Topic Author
- Offline
Less
More
- Posts: 36
- Thank you received: 1
4 years 2 days ago #106
by Yourwp
Yourwp replied the topic: [SOLVED] prevent double click "add to basket" button
on this page for example:
bit.ly/2lvR3lR
If you click the add to basket bttn quickly multiple times, the product quantity is increased with every click.
But because i use your plugin i disabled all quantity fields (the quantity is defined in the plugin fields)
bit.ly/2lvR3lR
If you click the add to basket bttn quickly multiple times, the product quantity is increased with every click.
But because i use your plugin i disabled all quantity fields (the quantity is defined in the plugin fields)
Please Log in or Create an account to join the conversation.
- Simone
-
4 years 2 days ago #105
by Simone
Simone replied the topic: [SOLVED] prevent double click "add to basket" button
Hi,
I don't really understand what you mean.
Are you talking about product page or category page?
Could you explain me better please?
Thank you Yourwp.
Regards,
Simone
I don't really understand what you mean.
Are you talking about product page or category page?
Could you explain me better please?
Thank you Yourwp.
Regards,
Simone
Please Log in or Create an account to join the conversation.
- Yourwp
-
Topic Author
- Offline
Less
More
- Posts: 36
- Thank you received: 1
4 years 2 days ago #96
by Yourwp
Yourwp created the topic: [SOLVED] prevent double click "add to basket" button
Hello,
is it possible to disable the "add to basket"-button after the first click?
I already tried, but it seems best practice to include this after the validation.
tx!!!
is it possible to disable the "add to basket"-button after the first click?
I already tried, but it seems best practice to include this after the validation.
tx!!!
Please Log in or Create an account to join the conversation.
Moderators: Simone, david
- Forum
- Support questions
- WooPrice Calculator (Pro)
- [SOLVED] prevent double click "add to basket" button
Time to create page: 0.164 seconds