Last active
September 13, 2024 22:41
-
-
Save kloon/4541017 to your computer and use it in GitHub Desktop.
WooCommerce Clear Cart via URL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// check for clear-cart get param to clear the cart, append ?clear-cart to any site url to trigger this | |
add_action( 'init', 'woocommerce_clear_cart_url' ); | |
function woocommerce_clear_cart_url() { | |
if ( isset( $_GET['clear-cart'] ) ) { | |
global $woocommerce; | |
$woocommerce->cart->empty_cart(); | |
} | |
} |
This doesn't work - does anyone have a current version of this??
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These all stopped working. I can't clear my cart with any of them.