Declare support for ajax_add_to_cart?
-
Hi,
I’ve spent quite a bit of time googling around the web trying to find some example starter documentation for integrating ajax add to cart funcitonality into a bespoke WooCommerce theme, with little to no success. Most of the links I find are for out of date versions of WooCommerce, or link to paid plugins to achieve this functionality.
From looking inside
woocommerce/assets/js/frontend/add-to-cart.js
it looks like the ajax code is only called if a button hasajax_add_to_cart
on it. I can see inwoocommerce/includes/abstracts/abstract-wc-product.php
that there is a supports array for “Supported features such as ‘ajax_add_to_cart’.”. How do I declare support for ajax_add_to_cart for specific products, or am I barking up the wrong tree entirely here?Ideally I want to use the core minicart on a page, and the core add-to-cart.js woocommerce script to enable ajax functionality in my theme. For some reason I can’t find any up to date or accurate information on this in the documentation. Any links or pointers on how to do this would be really appreciated.
Thanks
- The topic ‘Declare support for ajax_add_to_cart?’ is closed to new replies.