After customer registration, admin will verify his identity and activates that customer. For maintaining customer verify status I'm using IsVerified
as 1
in wp_usermeta
table.
Now, If customer adds product to his cart, I want to check that customer is verified or not. If verified then only I need actual cart process. If customer is not-verified then I want to redirect him/her to upload specified documents and the cart functionality no need to work. If not logged in need to redirect him to login page.
I'm new to woocommerce and wordpress so if any example it'll be easy to understand.
Updated Code is as below:
add_action('woocommerce_add_to_cart', 'custome_add_to_cart');
function custome_add_to_cart() {
$userId=get_current_user_id();
if($userId>0) {
$UserROW = get_user_meta($userId);
if( $UserROW['woo_VerifyStatus'][0] == 0 ) {
wp_redirect( get_home_url().'/gld/my-account');
} else {
//Normal cart functionality
}
} else {
wp_redirect( get_home_url().'/gld/my-account');
}
}