Programmatically create new site with template

Hi guys,

I have a quick question for you. We are succesfully using the New Blog Templates plugin and it works just fine, but we need a way to automatically deploy a blog when a product is purchased using woocommerce.

I know how to hook into Woo’s API to trigger an action when a new order comes in, and I know I can programatically deploy a new blog like this:

wpmu_create_user( $username, $password, $email )

wpmu_create_blog( $newdomain, $path, $title, $user_id , array( ‘public’ => 1 ), $current_site->id );

How can I define which template to apply to this new site?

Thanks!