title: How to get product variations only if the parent product is published
body: <p>I made a custom query to get the products variations, but when I trash a product, it's variations status will remain <code>publish</code>, so it will respond a <code>404</code> error if the customer tried to view the trashed product variations.
  So, how I can filter these variations to get only the variations that have published parent product?</p>
  
  <p>My code:</p>
  
  <pre><code>&lt;?php  
  $args = ['post_type'  =&gt; ['product_variation'],  
              'orderby'    =&gt; 'meta_value_num',
              'order'      =&gt; 'DESC',
              'post_status'=&gt;'publish',
              'product_type'=&gt;'variation',
              'meta_query' =&gt; [
                  [
                      'key'     =&gt; 'attribute_pa_flower-type',
                      'value'   =&gt; $flower_type,
                      'compare' =&gt; '=',
                  ]
              ]
          ];
  ?&gt;
  
  &lt;?php $the_query = new WP_Query( $args );?&gt;
  
  &lt;?php if ( $the_query-&gt;have_posts() ) : ?&gt;
  
      &lt;div class="boxes"&gt;
          &lt;?php while ( $the_query-&gt;have_posts() ) : $the_query-&gt;the_post(); ?&gt;
          ...
  </code></pre>