As long as the Booster for WC plugin prevents users from being able to login to WordPress before they have verified their email address, that code will be safe to use. When added to your theme, or to a plugin, it will allow users to login to your Discourse site without having to re-verify their email address.
This would also be possible. If you know the name of the metadata key that is being set by Woocommerce and the expected return value for users with verified email addresses, you could add a check for that to the function. Something like this:
add_filter( 'discourse_email_verification', 'wpdc_custom_discourse_email_verification', 10, 2 );
function wpdc_custom_discourse_email_verification( $require_activation, $user_id ) {
if ( 1 === get_user_meta( $user_id, 'wc_metadata_key', true ) ) {
$require_activation = false;
}
return $require_activation;
}
If you are running into any SSO login redirect issues with Woocommerce, you may need to install this plugin on your site: GitHub - scossar/wp-discourse-woocommerce-support: Integrates the wp-discourse plugin with WooCommerce · GitHub. Have a look at the plugin’s readme for details about what it does.