By default, the new user’s role is updated when the order status is changed to ‘Processing’. You can change this to update the new user’s role when the order status changes to ‘Complete’ using this snippet:
|* Assign roles when status is set to completed|
|add_action( 'woocommerce_order_status_completed', 'wcmo_assign_roles_after_purchase', 10 );|
Follow these steps to add the snippet to your site.