title: Woocommerce Show PDF attachment in Downloads tab as link
body: <p>I am trying to show a pdf in my downloads tab so that when someone is looking at my product they can open the pdf in a new window. I uploaded the pdf to the product via the media button. My callback looks like this and $attachments seems empty ideas?:</p>
  
  <pre><code>function woo_new_product_tab_content_downloads() {
  global $woocommerce, $product, $post;    
  $product_id = $post-&gt;ID;
  echo $product_id; 
  $product = new WC_Product( $product_id );
  print_r($product);
  // The new tab content
      $args = array(
      'post_type' =&gt; 'attachment',
      'orderby' =&gt; 'menu_order',
      'numberposts' =&gt; -1,
      'post_status' =&gt; null,
      'post_parent' =&gt; $product_id,
      'post_mime_type' =&gt; array( 'application/pdf')
      );
  
     $attachments = get_posts( $args );
     //print_r($attachments);
    if ( $attachments ) {
  
      foreach ( $attachments as $attachment ) {
  
         echo '&lt;p&gt;&lt;a href="';
         echo wp_get_attachment_url( $attachment-&gt;ID );
         echo '"&gt;';
         echo wp_get_attachment_image( $attachment-&gt;ID, '', true );
         echo '&amp;nbsp;&amp;nbsp;';
         echo apply_filters( 'the_title', $attachment-&gt;post_title );
         echo '&lt;/a&gt;';
         echo '&lt;/p&gt;';
        } 
   }
  }
  </code></pre>