Total : 0.00 €

Before contacting us, please make sure to check our F.A.Q

Please, login or register to our website in order to be able to post a presale question in the forum.

× WooPrice Calculator PRO

[SOLVED] prevent double click "add to basket" button

  • Simone
  • Simone's Avatar
1 year 8 months ago #132 by Simone
Simone replied the topic: [SOLVED] prevent double click "add to basket" button
Good Job, thanks for share! ;)

S

Please Log in or Create an account to join the conversation.

More
1 year 8 months 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');

Please Log in or Create an account to join the conversation.

  • Simone
  • Simone's Avatar
1 year 8 months 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:
$(‘.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.

More
1 year 8 months 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!

Please Log in or Create an account to join the conversation.

More
1 year 8 months 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!!

Please Log in or Create an account to join the conversation.

  • Simone
  • Simone's Avatar
1 year 8 months 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

Please Log in or Create an account to join the conversation.

More
1 year 8 months 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)

Please Log in or Create an account to join the conversation.

  • Simone
  • Simone's Avatar
1 year 8 months 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

Please Log in or Create an account to join the conversation.

More
1 year 8 months 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!!!

Please Log in or Create an account to join the conversation.

Moderators: Simonedavid
Time to create page: 0.911 seconds

Cart

Total : 0.00 €