title: How to get products similar to my current product using its category on wordpress
body: <p>I wanted to get all my products from the category of my current post (I want to create a gallery of my similar products).
  I get the category of my current post but I am blocked after.</p>
  <p>more details : I have created a page template for my products and I would like on each of my &quot;product&quot; pages to display similar products. I would therefore like to display all the products that have the same category as my product.</p>
  <p>Could you help me please?</p>
  <pre><code>global $post;
  $postcat = get_the_category( $post-&gt;ID );
  
  
  </code></pre>