Code Snippets

Clear Cart for WooCommerce

<input type="submit" class="button" name="clear-cart" value="<?php _e('Empty Cart', 'woocommerce'); ?>" />
view raw cart.php hosted with ❤ by GitHub
/**
* Clear Cart for WooCommerce
*/
add_action( 'init', 'we_woocommerce_clear_cart_url' );
function we_woocommerce_clear_cart_url() {
global $woocommerce;
if( isset($_REQUEST['clear-cart']) ) {
$woocommerce->cart->empty_cart();
}
}
view raw functions.php hosted with ❤ by GitHub