title: Exclude Products from loop using woocommerce
body: <p>I have to exclude some products in category loop product page using woocommerce. Only that products, have specific value in meta table will be excluded. I have written below code but this is not working for me. Please somebody help me.</p>
  
  <pre><code>add_filter( 'pre_get_posts', 'custom_pre_get_posts_query' );
  
  function custom_pre_get_posts_query( $q ) {
  
        if ( ! $q-&gt;is_main_query() ) return;
        if ( ! $q-&gt;is_post_type_archive() ) return;
  
       $q-&gt;set( 'meta_query', array(array(
                   array(
                       'key' =&gt; '_auction_closed',
                        'compare' =&gt; 'NOT EXISTS'
                      )
                   )
                 )
               );
  
      remove_filter( 'pre_get_posts', 'custom_pre_get_posts_query' );
  
  }
  </code></pre>