add_filter( 'woocommerce_add_to_cart_validation', 'custom_empty_cart', 10, 3 );
function custom_empty_cart( $passed, $product_id, $quantity ) {
    if( ( ! WC()->cart->is_empty() ) ){
              WC()->cart->empty_cart();
       }
    return $passed;
}