Hello. Thank you for contacting the Toolset support.
Can you please share admin access details as well as member access details and do you mean that on shop page those product should not be displayed?
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I've added the following code to "Custom Code" section offered by Toolset with the code snippet namely "toolset-custom-code":
=> hidden link
add_action( 'pre_get_posts', 'func_remove_products_from_access_group_posts_archive_result',99,1);
function func_remove_products_from_access_group_posts_archive_result( $query ) {
// skip if admin side or not main query
if ( is_admin() || ! $query->is_main_query() ) return;
// check if the query is for a specific post type
if ( in_array ( $query->get('post_type'), array('product') ) ) {
$user = wp_get_current_user();
global $wpcf_access;
global $current_user;
//// get the post group slug belongs to toolset access assigned to post to check the permission
$post_group_slug = 'wpcf-custom-group-edffc382fce896fb1838d71d60d9ed58';
$permited_roles = $wpcf_access->settings->types[$post_group_slug]['permissions']['read']['roles'];
// get current user role
$current_user_role = $current_user->roles;
$private_ids = array();
if(empty($current_user_role)){
$args = array(
'post_type' => 'product',
'meta_query' => array(
array(
'key' => '_wpcf_access_group',
'value' => $post_group_slug,
),
),
'fields' => 'ids',
'posts_per_page' => -1,
);
///// get posts where post group is assigned
$private_ids = get_posts($args);
/// remove the posts from the view result belongs to post group
$query->set('post__not_in',$private_ids);
}
}
}
I can see now only one product that is publically available and not assigned to access post group.