Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Let's wait for the button to be clicked on
- add_action( 'template_redirect', 'empty_cart_button_handler' );
- function empty_cart_button_handler() {
- if( isset( $_POST['empty_cart'] ) && $_SERVER['REQUEST_METHOD'] == "POST" ) {
- WC()->cart->empty_cart( true );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement