1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Registration
  5. Display notice to user if their account is pending
  1. Home
  2. Knowledge Base
  3. WooCommerce Members Only
  4. Display notice to user if their account is pending

Display notice to user if their account is pending

If you want to let users know that their accounts are still pending, you can use this snippet:

<?php
/**
* Display notice to user if their account is pending
*/
function prefix_check_user_role() {
if( wc_current_user_has_role( 'pending' ) ) {
wc_add_notice(
'Your account is still pending',
'notice'
);
}
}
add_action( 'init', 'prefix_check_user_role' );

Here’s how to add the snippet.

Was this article helpful?

Related Articles