如何使用数组过滤掉Woocommerce中隐藏的产品

I have an array, but I am unable to add in a last bit, where I want to filter out the products, that are hidden, which doesn't seem to be working.

So firstly I have tried to print out all variables using get_defined_vars() which printed out all variables as expected. Then I have found the part of array I was interested in

Array ( [name] => Test1 
        [slug] => test1 
        [date_created] => WC_DateTime Object ( 
            [utc_offset:protected] => 0 
            [date] => 2018-03-06 11:29:10.000000 
            [timezone_type] => 3 
            [timezone] => Europe) 
        [date_modified] => WC_DateTime Object ( 
            [utc_offset:protected] => 0 
            [date] => 2018-05-30 22:33:49.000000 
            [timezone_type] => 3 
            [timezone] => Europe) 
        [status] => publish 
        [featured] => [catalog_visibility] => hidden 

which I thought is all I need, so I have tried to insert into the array this line:

'catalog_visibility' => 'visible', which didn't work. Do I have to include also the [featured] element to make it working?

Doing echo $product->visibility; prints out, if the product is hidden or visible.

I have this array:

$args = array(
     'post_type' => 'product',
      'orderby' => 'rand',
      'posts_per_page' => 1,
      'product_cat' => 'c_pubescens',
      'post_status' => 'publish',
      'meta_query' => array(
           array(
               'key' => '_stock_status',
               'value' => 'instock'
       )
  )
);
$loop = new WP_Query( $args );

I am lost in this. Why does it print the status, if I do echo $product->visibility; but if I do echo $product->catalog_visibility; (which is in the array) it doesn't return anything? And mainly, how do I make it work?