title: Get Products by Category id
body: <p>i am writing a pricing table plugin for woocommerce. the user inserts the shortcode with an id of woocommerce products category and after updating the page the user can see a table with a list of product's names and prices.<br>
  how can i get a list of products with the id of their category?!<br>
  in the code below <strong>$pid</strong> is what the user type in shortcode, <strong>'object_id'</strong> is the id of the every product in wp_posts table.</p>
  
  <pre><code>&lt;?php
      $products = $wpdb-&gt;get_results("SELECT object_id FROM {$wpdb-&gt;term_relationships}
                                        WHERE term_taxonomy_id = " . $pid);
      if(!empty($products))
      {
          foreach($products as $product)
          {
              //the code
          }
      }
  ?&gt;  
  </code></pre>
  
  <p>Thanks in advance.</p>