remove_action('woocommerce_before_single_product','woocommerce_output_all_notices',10);// Disable purchase for non-logged-in users. (Remove add-to-cart button). function m3wc_woocommerce_is_purchasable($is_purchasable,$product){if (! is_user_logged_in()){return false}return $is_purchasable}add_filter('woocommerce_is_purchasable','m3wc_woocommerce_is_purchasable',10,2);// Show "Login to see prices" instead of price for non-logged in users. //function m3wc_woocommerce_get_price_html($price){// if (! is_user_logged_in()){// return '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">Login</a> to Order';//}// return $price;//}//add_filter('woocommerce_get_price_html','m3wc_woocommerce_get_price_html',10,2);// //add_action('template_redirect','checkout_redirect_non_logged_to_login_access');//function checkout_redirect_non_logged_to_login_access(){// Here the conditions (woocommerce checkout page and unlogged user) // if(is_page(10) && is_user_logged_in()){// Redirecting to your custom login area // wp_redirect(get_permalink(get_option('woocommerce_myaccount_page_id')));// always use exit after wp_redirect() function. //// exit;//}//}// Add CSS class for logged in and logged out users add_filter('body_class','er_logged_in_filter');function er_logged_in_filter($classes){if(is_user_logged_in()){$classes[]='logged-in-condition'}else{$classes[]='logged-out-condition'}// return the $classes array return $classes}//CODE FOR LOGOUT WITHOUT CONFIRMATION add_action('template_redirect','logout_confirmation');function logout_confirmation(){global $wp;if (isset($wp->query_vars['customer-logout'])){wp_redirect(str_replace('&amp;','&',wp_logout_url(../../../../../../themes/hello-theme-child-master/wc_get_page_permalink('myaccount'))));exit}}// Only show products in the front-end search results add_filter('pre_get_posts','lw_search_filter_pages');function lw_search_filter_pages($query){// Frontend search only if (! is_admin() && $query->is_search()){$query->set('post_type','product');$query->set('wc_query','product_query')}return $query}