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

Home – SaaS Forums Support questions WooPrice Calculator (Pro) [SOLVED] prevent double click add to basket” button”

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #8385
    Yourwp
    Participant

    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!!!

    #8393
    Anonymous
    Guest

    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

    #8392
    Yourwp
    Participant

    on this page for example:
    http://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)

    #8391
    Anonymous
    Guest

    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: https://it.wordpress.org/plugins/woocommerce-max-quantity/

    Regards,
    Simone

    #8390
    Yourwp
    Participant

    Ok, i will check.

    I just need to make sure that when they start a new calculation, the product can be added again.

    tx!!

    #8389
    Yourwp
    Participant

    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!

    #8388
    Anonymous
    Guest

    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

    #8387
    Yourwp
    Participant

    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(){ ?>

    #8386
    Anonymous
    Guest

    Good Job, thanks for share! 😉

    S

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.