WC_Customer delete function returns error

Welcome!

You need to include 'wp-admin/includes/user.php' before calling wp_delete_user function. The reason is, it is an admin functionality and it is not available everywhere in code.

In Your case, just put the following line of code at the very beginning of the function.

require_once ABSPATH . 'wp-admin/includes/user.php';