Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table.
use this:
add_action('woocommerce_order_status_completed', 'save_to_donors',10,1);
instead of this:
add_action('user_register', 'save_to_donors',10,1);
also change $user_id
to $order_id
as the parameter being passed into your function.
You will need to make some changes to your function since now $order_id
will be passed into your function instead of $user_id
. You can use some of the following code to get the $order
object and $user_id
I also found some other code that will get you info from the order vs from the users meta, not sure if they are going to be different.
$order = new WC_Order( $order_id );
$user_id = $order->user_id;
$billing_address = $order->get_billing_address();
$billing_address_html = $order->get_formatted_billing_address(); // for printing or displaying on web page
$shipping_address = $order->get_shipping_address();
$shipping_address_html = $order->get_formatted_shipping_address(); // for printing or displaying on web page
Info on the use of this hook woocommerce_order_status_completed
Info on how to get user id from order id