I have been searching for a while, this. I want to add an item via AJAX. When you add an item to a cart in Woocommerce the page reloads with the GET parameter add-to-cart="The current product ID".

I want to do it via AJAX. In the admin area is a checkbox to enable that featured that is labeled “Enable AJAX buttons to add to cart on the product list”

But it doesn’t do anything, it stills reloading the page.

1
1

are we talking about the single product view or the product archive pages (shop,categories)?

because the text beside the checkbox/option states, roughly translated:

»activate ajax-checkout-button on product archive pages«

and on all the installations i did so for, that is the way its working – ajax checkout on the archives, but not on the single view.

the latter you have to implement yourself or maybe you find a free plugin for that.


Follow up:

A basic example on how to use AJAX for the »add-to-cart«-functionality of woocommerce can be found here:
Woocommerce – Add a product to cart programmatically via JS or PHP.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *