In my store, B2B users require manual approval when completing the registration form. After submitting the registration form, I need to redirect the user to a landing page where they will receive information stating that their account is pending validation. They will also be notified by email once their account is approved.
How can I set up this redirection for the B2B registration form submission?I haven't found this solution in the documentation.
I believe that that redirect code is causing a conflict. Here is the problem: when B2BKing registers a manual approval user, WooCommerce automatically logs in the user (Standard functionality) - B2BKing must log out the user as we don't want them to be logged in until approval. When B2BKing logs out the user, your redirect code is triggered.
Please try to change the code to this one:
add_action('wp_logout','owp_redirect_after_logout', 10, 1);
function owp_redirect_after_logout($user_id){
$user_approval = get_user_meta($user_id, 'b2bking_account_approved', true);
if ($user_approval !== 'no'){
wp_redirect('https://blisscare-lab.com/');
exit();
}
}
Hello!
In my store, B2B users require manual approval when completing the registration form. After submitting the registration form, I need to redirect the user to a landing page where they will receive information stating that their account is pending validation. They will also be notified by email once their account is approved.
How can I set up this redirection for the B2B registration form submission?I haven't found this solution in the documentation.
I'm awaiting your answer, ASAP.
Best regards!
Hi there,
It should be possible to do that, by adding this PHP code snippet to your site:
You'd just need to change the URL to your own,
A PHP snippet can be added to functions.php, or by following our guide here: https://woocommerce-b2b-plugin.com/docs/how-to-add-a-snippet-php-or-js/
Kind regards,
Stefan
Hi again,
I looked into this now on your site,
It seems that there's a conflict with the following plugin:
YITH WooCommerce Customize My Account Page Premium
If you deactivate that plugin, you will see registrations redirect to https://blisscare-lab.com/pendiente-validacion-usuario/
I checked further and it seems it's related to this YITH setting:
If you deactivate it, it then works.
Kind regards,
Stefan
Hi there,
I believe that that redirect code is causing a conflict. Here is the problem: when B2BKing registers a manual approval user, WooCommerce automatically logs in the user (Standard functionality) - B2BKing must log out the user as we don't want them to be logged in until approval. When B2BKing logs out the user, your redirect code is triggered.
Please try to change the code to this one:
I think that can resolve it.
Kind regards,
Stefan
Hi there,
My understanding is that the error says you already have the other logout snippet active and it cannot redeclare the function.
You must deactivate the other code snippet with the logout redirect - both should not be active at the same time.