Skip to content

Instantly share code, notes, and snippets.

@vishalbasnet23
Created October 10, 2014 06:40
Show Gist options
  • Save vishalbasnet23/0f3e433b038584091e50 to your computer and use it in GitHub Desktop.
Save vishalbasnet23/0f3e433b038584091e50 to your computer and use it in GitHub Desktop.
Simple filter to add empty cart url
add_action( 'init', 'woocommerce_clear_cart_url' );
function woocommerce_clear_cart_url() {
global $woocommerce;
if ( isset( $_GET['empty-cart'] ) ) {
$woocommerce->cart->empty_cart();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment