• You MUST read the Babiato Rules before making your first post otherwise you may get permanent warning points or a permanent Ban.

    Our resources on Babiato Forum are CLEAN and SAFE. So you can use them for development and testing purposes. If your are on Windows and have an antivirus that alerts you about a possible infection: Know it's a false positive because all scripts are double checked by our experts. We advise you to add Babiato to trusted sites/sources or disable your antivirus momentarily while downloading a resource. "Enjoy your presence on Babiato"

WooCommerce Add to Cart Trigger

Graphic46

Active member
Oct 2, 2018
419
99
28
Hi Forum!

How can I automatically reduce the quantity value back to one when added to the cart?

For example, you can look at this page. https://peakshops.fuelthemes.net/peakshops-organicmarket/product/cropped-faux-leather-jacket/

i change quantity to ten and i click add to cart button.
Then i want to only one. i click add to cart. again its will add to ten in my cart.
i dont want to it. because speed is important for the customer. how do I get it to fall automatically? how can i solve this with javascript, jquery or function.php?

I realy need this. Thanks.
 
Thnks bro. but dont want to it. customer can add as many products as he wants. I just want the amount to automatically drop to the 1 value when click add to cart button.
 
Not sure If I understand you correctly. If I add to card 10x tomatoes, I will get 10x tomatoes in the card.

Do you want to reset quantity from anything to 1 once the quantity is added to cart?

Why would you want this? If customer select quantity he needs, he probable doesn't care whats the state of a quantity field. If he change his mind about the quantity, he can easily add or remove items from within his cart.

Explain in more detail please because this doesn't make sense to me. Cheers
 
  • Like
Reactions: samiraja
Not sure If I understand you correctly. If I add to card 10x tomatoes, I will get 10x tomatoes in the card.

Do you want to reset quantity from anything to 1 once the quantity is added to cart?

Why would you want this? If customer select quantity he needs, he probable doesn't care whats the state of a quantity field. If he change his mind about the quantity, he can easily add or remove items from within his cart.

Explain in more detail please because this doesn't make sense to me. Cheers
Yeah me too
 
Not sure If I understand you correctly. If I add to card 10x tomatoes, I will get 10x tomatoes in the card.

Do you want to reset quantity from anything to 1 once the quantity is added to cart?

Why would you want this? If customer select quantity he needs, he probable doesn't care whats the state of a quantity field. If he change his mind about the quantity, he can easily add or remove items from within his cart.

Explain in more detail please because this doesn't make sense to me. Cheers
He's clearly confused.
 
This my quantity selector and add to cart button.

HTML:
<form action="?add-to-cart=90" class="cart" method="post" enctype="multipart/form-data">
<div class="quantity">
        <div class="qty-box">
            <span class="decrease"></span>
            <input type="number" id="quantity_5edb532feef89 sw-qua" class="input-text qty text" step="1" min="0" max="33" name="quantity" value="1" title="Qty" size="4" placeholder="" inputmode="numeric">
             <span class="increase"></span>
        </div>
    </div>
 <button type="submit" id="sw_add_to_cart" data-quantity="1" data-title="Pampers Swaddlerss" data-product_id="90" class="button alt ajax_add_to_cart add_to_cart_button product_type_simple">Add to cart</button></form>




This is my jquery script.

JavaScript:
        $("form.cart").on("click", "sw_add_to_cart", function() {
            $("input.sw-qua").val( "1" ).change();
        });



but did not work. how to run correctly?
 
I want each addition to the shopping cart to start at 1. Not where it left off. ok? it's simple. if u add to cart 10x tomato. and i add want to only 1 more without the need to go to the cart page.

that's actually what I want to do = https://www.willys.se/
but it seems difficult.
so my solution will do my job for now.
 

Forum statistics

Threads
79,277
Messages
1,138,184
Members
247,737
Latest member
stasmartyn
AdBlock Detected

We get it, advertisements are annoying!

However in order to keep our huge array of resources free of charge we need to generate income from ads so to use the site you will need to turn off your adblocker.

If you'd like to have an ad free experience you can become a Babiato Lover by donating as little as $5 per month. Click on the Donate menu tab for more info.

I've Disabled AdBlock