I have a registration form where I programmatically create the user.
I need to be able to add that user to a membership plan already setup in WooCommerce and my current context is $user = new WP_User($userId);
I've looked everywhere and can't find a solution, even after digging through the code.
To be clear, I'm not doing this from an admin interface perspective, that part is clear. I'm doing this within PHP, immediately after the user registers their attendees (we automatically create users for their attendees and add them to the correct membership)