I have found the following code to empty my cart on wordpress/woocommerce.
add_action('init', 'woocommerce_clear_cart_url');
function woocommerce_clear_cart_url() {
global $woocommerce;
if( isset($_REQUEST['clear-cart']) ) {
$woocommerce->cart->empty_cart();
}
}
To execute this I add ?clear-cart to any URL on my site, I'm a little over my head here. But I was wondering if there was a way using jQuery or something to execute this function without a page refresh?