Hi, I need a Subscription solution to my website. Have read your tutorial "How to use the WooCommerce Subscriptions plugin with Toolset" and I have one question. I have a WordPress Multisite and when a user registers, I want the new user to automatically get a subsite on the network (www.mainsite.com/username). Has a funciton that has worked with regular registration:
add_action ('user_register', 'user_registration_create_site', 10, 1);
function user_registration_create_site ($ user_id) {
$ user_info = get_userdata ($ user_id);
if (isset ($ user_info-> user_login)) {
$ main_site = 'weareyou.online'; // Add your main domain here
wpmu_create_blog ($ main_site, '/'.$user_info->user_login.'/', $ user_info-> user_login, $ user_id, array ('public' => 1));
}
}
Will the function also work if I follow the steps of the description "How to use the WooCommerce Subscriptions plugin with Toolset"?
/ Nicklas
Hi, at first glance it looks okay to me but I'm not 100% certain. The registration and subscription process described in that document is all handled by WooCommerce Subscriptions. Toolset's APIs aren't used during the process, and I don't have detailed technical information about when the user_register hook is fired by WooCommerce Subscriptions. I recommend trying it out on a test or staging site before you implement it on a real site. If you need more detailed information about registration workflow with WooCommerce Subscriptions, I recommend reaching out to their support team or reviewing their documentation.