PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Add to cart max quantity

This support system is for all types of the plugins as for premium versions, so for free ones! If you have premium version do not forget in the private data of the request (!!not in the text of the support request!!) after its publishing insert purchase code please (see blue-green button on the right side) and press Save button.
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi!

 

I would like to let my clients to add to cart more than max 5 products (eg. 10x single variant). I didn't find any information about that in documentation, codex and in settings.

You can check that you can not add more than 5 pieces here: https://produkcja.lavel.pl/dostepne-produkty/

For example this product: Panties Aleksja / Negro - majtki kąpielowe z wysokim stanem, variant: rozmiar 44

Hello

Try  in  file - wp-content\plugins\woot-products-tables\profiles\woocommerce\js\woocommerce-cart.js - change  code - https://share.stackovergo.com/image/i20210826102358.png

Works as a charm!

Here is what I've changed:

                let input = document.createElement('input');
                input.className = 'woot-add-to-cart-input';
                input.value = 1;
                input.setAttribute('min', 1);
                input.setAttribute('step', 1);
                input.setAttribute('max', 20);// quantity);
                input.setAttribute('size', 4);
                input.setAttribute('type', 'number');
                input.setAttribute('inputmode', 'numeric');
Isn't it a good idea to move this quantity into settings page and dynamically load it from database?

Hello

I will pass it to the developers

Great, thanks for your great support!!

Hello

Welcome;)

I have a post-help question :D

I just realized that when I change code inside your plugin, the change will be overwritten by plugin's updates.

How to achieve same effect but in my files? Maybe a script that can set the attribute on the input -> input.setAttribute('max', 20);. But those inputs are generated dynamically, so I can't bind events to them "on page load". Do you fire some events when the variations table is popping up?

I did some research in your files, and I have found event "woot-do-after-draw'. I'm using it to add listener for clicks made on popup's background area to close the popup.

Should I just set this "max" attribute to each variant?

 

My background clicks script:

document.addEventListener('woot-do-after-draw', function(e){
    var tableID = e.detail.otable.container.attributes.id.nodeValue;
    console.log(tableID);
    if(tableID){
        var theTable = jQuery('#' + tableID);
        var backgroundModal = theTable.closest('.woot-dynamic-popup-wrapper').find('.woot-modal-backdrop');
        backgroundModal.one('click', function(e){
            var table = theTable.closest('.woot-dynamic-popup-wrapper').find('.woot-modal .woot-modal-inner .woot-modal-inner-footer .woot-btn')[0];
            if(table){
                theTable.closest('.woot-dynamic-popup-wrapper').find('.woot-modal .woot-modal-inner .woot-modal-inner-footer .woot-btn')[0].click();
            }
        });
    }
});

Hello

Use  event : table23-after-build-rows     - ( https://c2n.me/4dcnnY0.png )

This value must be set for each product.