Home › Forums › WoodMart support forum › AJAX Add to cart
AJAX Add to cart
- This topic has 8 replies, 2 voices, and was last updated 4 years, 7 months ago by Artem Temos.
-
AuthorPosts
-
May 6, 2020 at 4:10 pm #192845
EntreDosComParticipantHi we have bought the Woocommerce Wishlist plugin from the official Woocommerce marketplace, it turns out that having activated the AJAX in Add to Cart button what it does is Add the product to the cart. We have consulted with the developer and he answered this if it can be solved because we are interested in working with Ajax, we left it activated so you can see it thank you very much!
Here is an example: https://nuvole.es/tienda/conjunto-cubrepanal-acuario-rosa-palo/
DEVELOPER (LUCAS STARK): This is because something in your theme is intercepting the click event and clicking the add to cart button, because it’s trying to submit it via AJAX. I’d recommend disabling AJAX add to cart features from your theme so that it’s not conflicting with other button presses on the form. Alternatively, let the theme author know that their button handler script is too aggressive and needs to target the click event specifically of the add to cart button, otherwise it’ll consume clicks it’s not supposed to.
May 7, 2020 at 6:11 am #192965
Artem TemosKeymasterHello,
Our AJAX add to cart action is triggered on WooCommerce form submit an event and not on the button click
$('body').on('submit', 'form.cart', function (e) {
. It means that the plugin’s button click triggers this form submit event. We are not able to prevent this.Kind Regards
May 7, 2020 at 8:15 am #193015
EntreDosComParticipantThanks, I sent your reply to plugin developer.
thanks!
May 7, 2020 at 9:00 pm #193262
EntreDosComParticipantHe replied me this:
That is exactly what I meant. They should be attached to the button, not to the form submission event. We dynamically change the form action with the wishlist extension and submit the form, that allows us to intercept the submission so rather than it going to the cart it’ll go to a list. We can’t do that if the form is submitted via Ajax, and if they are hooked on to the general form submit action rather than specifically to the form’s submit button.
May 8, 2020 at 6:09 am #193328
Artem TemosKeymasterIn some situations, WooCommerce doesn’t submit the form when the button is clicked. That is why the button click event is not suitable for that. We need to be sure that the whole form is submitted.
May 8, 2020 at 8:55 pm #193556
EntreDosComParticipantHi, we finally solved the incident changing the button style! Only happens with Circle Buttons!
thanks.
May 9, 2020 at 6:42 am #193598
Artem TemosKeymasterStrange, but we are glad that you sorted it out.
May 9, 2020 at 10:19 am #193630
EntreDosComParticipantHi Artem, no, always happens with Ajax activated and the developer does not want to know anything, we will have to work with Ajax disabled that we do not like the idea very much.
Thanks anyway!!
May 9, 2020 at 12:35 pm #193659
Artem TemosKeymasterOK, contact us if you will have any extra questions.
-
AuthorPosts
- You must be logged in to create new topics. Login / Register