• Resolved snehip30

    (@snehip30)


    My site has doctor clinic related products. Some products are prescribed which are only visible to register verified users. So normal user cannot see all the products. That functionality has already done.
    But in this advanced search bar if we search then all products are showing in the dropdown.
    But we need to remove prescribed products that should not come in drop down if a user is not loged in.
    For prescribed products we have used meta_query.
    So can anyone help me how I can remove some products from search bar if user is not loged in.
    Any hook or query?

Viewing 1 replies (of 1 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    You can do this by using plugin filter aws_search_pre_filter_products
    So code can look like that

    add_filter( 'aws_search_pre_filter_products', 'my_aws_search_pre_filter_products' );
    function my_aws_search_pre_filter_products( $products_array ) {
        if (  ! is_user_logged_in() && $products_array && ! empty( $products_array ) ) {
            // walk throw $products_array and unset some of them
        }
        return $products_array;
    }

    Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Search related new query’ is closed to new replies.