Quantcast
Viewing all articles
Browse latest Browse all 134440

mike52 on "Executing Query String in Wordpress without refresh"

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?


Viewing all articles
Browse latest Browse all 134440

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>