Answer the question
In order to leave comments, you need to log in
Why is jQuery not working in Woocommerce mini cart?
Good afternoon guys! Faced a problem. Woocommerce mini cart needs to have an add/reduce function. I have the front. Just something to do here are the chips:
which I actually did.
But the behavior of these chips is extremely strange. Let's say I went to the site, the cart is empty, I added a product, the product was added using ajax without reloading the page. I try to press +/- and it doesn't respond. It feels like these elements are simply not there, so jQuery simply does not process them. But why and how to improve the situation? Tell me please. There are no errors in the console.
Answer the question
In order to leave comments, you need to log in
If you hang a click handler on these buttons when the product is not yet in the mini-cart, then when you create these elements with ajax, they will not have the event handler that you did earlier. Create event handling in a delegate way like $('mini-cart-class').on('click', 'plus/minus button', function(){})
Weird. What answer would you like to receive?
From your description it is not clear how you added them, independently (through hooks) or with the help of a plugin.
If on your own, then you should have written the code for handling clicks. Then it would be nice to show it here.
If a plugin, then you need to watch the plugin.
Why did you decide that jQuery is to blame?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question